Good evening,
i´m at the beginning of learning java and i have a question to a code i wrote which isn´t working like it should.
Following you´ll see it:
package Kapitel_4;
import java.util.Scanner;
public class Schrauben
{
public static void main(String[] args)
{
//Scanner
Scanner scan = new Scanner(System.in);
System.out.println("Bitte geben Sie den Durchmesser der Schraube ein.");
int durchmesser = scan.nextInt();
System.out.println("Bitte geben Sie die Länge der Schraube ein.");
int länge = scan.nextInt();
scan.close();
//Variablen boolean
boolean durchmesser1 = (0 < durchmesser < 3);
boolean durchmesser2 = (4 < durchmesser < 6);
boolean durchmesser3 = (7 < durchmesser < 20);
boolean länge1 = (0 < länge < 20);
boolean länge2 = (21 < länge < 30);
boolean länge3 = (31 < länge < 50);
//Verzweigung
if (durchmesser1 && länge1)
{
System.out.println("Typ 1");
}
else if (durchmesser2 && länge2)
{
System.out.println("Typ 2");
}
else if (durchmesser3 && länge3)
{
System.out.println("Typ 3");
}
else
{
System.out.println("Unbekannter Schrauebntyp");
}
}
}
Syntax error on token "<", << expected
Syntax error on token "<", << expected
Syntax error on token "<", << expected
Syntax error on token "<", << expected
Syntax error on token "<", << expected ...
... it says and means the things i highlighted.
I don´t understand why i need a << and a < isn´t working.
And if i write << the whole program isn´t working and the only thing you see on the console is "Typ 1".
i don´t understand.
please help me.
good night
post scriptum (p.s.):
I´m sorry that the program is in german. I´m from Germany. Maybe if you want you can answer in german.
i´m at the beginning of learning java and i have a question to a code i wrote which isn´t working like it should.
Following you´ll see it:
package Kapitel_4;
import java.util.Scanner;
public class Schrauben
{
public static void main(String[] args)
{
//Scanner
Scanner scan = new Scanner(System.in);
System.out.println("Bitte geben Sie den Durchmesser der Schraube ein.");
int durchmesser = scan.nextInt();
System.out.println("Bitte geben Sie die Länge der Schraube ein.");
int länge = scan.nextInt();
scan.close();
//Variablen boolean
boolean durchmesser1 = (0 < durchmesser < 3);
boolean durchmesser2 = (4 < durchmesser < 6);
boolean durchmesser3 = (7 < durchmesser < 20);
boolean länge1 = (0 < länge < 20);
boolean länge2 = (21 < länge < 30);
boolean länge3 = (31 < länge < 50);
//Verzweigung
if (durchmesser1 && länge1)
{
System.out.println("Typ 1");
}
else if (durchmesser2 && länge2)
{
System.out.println("Typ 2");
}
else if (durchmesser3 && länge3)
{
System.out.println("Typ 3");
}
else
{
System.out.println("Unbekannter Schrauebntyp");
}
}
}
Syntax error on token "<", << expected
Syntax error on token "<", << expected
Syntax error on token "<", << expected
Syntax error on token "<", << expected
Syntax error on token "<", << expected ...
... it says and means the things i highlighted.
I don´t understand why i need a << and a < isn´t working.
And if i write << the whole program isn´t working and the only thing you see on the console is "Typ 1".
i don´t understand.
please help me.
good night
post scriptum (p.s.):
I´m sorry that the program is in german. I´m from Germany. Maybe if you want you can answer in german.