forked from erenuygur/EfficientHouseJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScannerClass.java
More file actions
50 lines (32 loc) · 1.16 KB
/
ScannerClass.java
File metadata and controls
50 lines (32 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package lessons.consolio;
public class ScannerClass {
public static void main(String[] args)
{
java.util.Scanner input = new java.util.Scanner(System.in);
int x = 5;
int y = 6;
if (x < y) // Condition 'x < y' is always 'true'
System.out.println(y);
System.out.println("First int: ");
int firstNumber = input.nextInt();
System.out.println("Second int: ");
int secondNumber = input.nextInt();
if (firstNumber < secondNumber)
System.out.println("second number > first number");
System.out.print("Double: ");
double d = input.nextDouble();
System.out.print("float: ");
float f = input.nextFloat();
System.out.print("byte: ");
byte b = input.nextByte();
System.out.print("short: ");
short s = input.nextShort();
System.out.print("boolean: ");
boolean bool = input.nextBoolean();
String temp = input.nextLine();
System.out.println(temp.isEmpty());
System.out.print("text:" );
String str = input.nextLine();
System.out.print(str.isEmpty());
}
}