-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaVariables.java
More file actions
33 lines (27 loc) · 960 Bytes
/
Copy pathJavaVariables.java
File metadata and controls
33 lines (27 loc) · 960 Bytes
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
public class JavaVariables {
public static void main(String[] args) {
// if we use the variable ; type name = value ;
int x =5; // whole numbers -2^32 and 2^32
// type and value must be match.
double y = 4.5 ; // -2^64 and 2^64
//float g = 2.9 ; // -2^32 and 2^32
String name = "Aliş";
/*RULES for writing class name
* We cannot use the spaces in your class name.
* Class name cannot contain special char. !! _ $ letters numbers
* it starts with capital letter.
*
* Rules for writing variable's name
* It cannot be started number . It can be contain number.
* first word can be lower case letter,other words can be capital letter. exp; studentName
*
*/
int a; // declare
a= 8; // assing a value
a=1000; // updating
// we give the variable's name. we should be careful because java is case sensitive prog. language.
int b = 7 ;
System.out.println(a);
System.out.println(x+y);
}
}