Repository navigation
Expand file tree
/
Copy pathvariable_datatype.java
More file actions
64 lines (48 loc) · 2.12 KB
/
Copy pathvariable_datatype.java
File metadata and controls
64 lines (48 loc) · 2.12 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//? so, variables are containner.. okk we store as value and data on it .. but we also include sepeprate name for each one to identified which one
//?is required .. containner have diffrent type */
//! there is a 8 type of data type in java
//! int short char boolean float double byte long */
//? they all have diffrent range to store data we can find by formula -2^(n-1) to 2^(n-1)-1
//! mostly all data type have defual value as 0 float have 0.0f and char have \U000 and boolean have false
//** for understand data types */
// import java.util.Scanner;
// public class variable_datatype {
// public static void main(String[]args) {
//TODO lets write code..
// byte age = 34;
// int age2 = 56;
// short age3 = 87;
// long ageDino = 5666666666666L;
// char ch = 'A';
// float f1 = 5.6f;
// double d1 = 4.66;
// boolean a = true;
// System.out.print(age);
// String str = "Harry";
// System.out.println(str);
// }
// }
//** for understand scanner class */
import java.util.Scanner;
public class variable_datatype {
public static void main(String[]args) {
// //TODO lets write code..
System.out.println("Taking Input From the User");
Scanner sc = new Scanner(System.in);
// System.out.println("Enter number 1");
// int a = sc.nextInt();
// float a = sc.nextFloat();
// System.out.println("Enter number 2");
// int b = sc.nextInt();
// float b = sc.nextFloat();
// int sum = a +b;
// float sum = a +b;
// System.out.println("The sum of these numbers is");
// System.out.println(sum);
// boolean b1 = sc.hasNextInt();
// System.out.println(b1);
// String str = sc.next();
String str = sc.nextLine();
System.out.println(str);
}
}