-
Notifications
You must be signed in to change notification settings - Fork 0
/
OperatorEx.java
63 lines (43 loc) · 1.47 KB
/
OperatorEx.java
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
63
import java.util.*;
import java.util.Scanner;
class OperatorEx {
public static void main(String args[]){
//Taking value in a variable
/* String a,b;
a ="NItesh";
b ="Kumar";
System.out.print("My Name is " +a +" "+ b); */
//using imput as a string
/* String a;
Scanner scan = new Scanner(System.in);
System.out.print("enter your String ");
a =scan.nextLine();
System.out.print("Output is "+" "+ a);
*/
//taking input ad a decimal
/*
float a,b;
a = 2.0f;
b = 2.0f;
System.out.print("double value is"+ a +b );
*/
//type conversion
/* double z=90.0;
int x= (int)z;
System.out.print("float no"+" " +x);
*/
//increment operator
/* int a = 15,c;
c = ++a + ++a + ++a;
System.out.print(c+"\n"); */
/* int a = 10,c;
c= a++ + a++ + a++ ;
System.out.print(c);
*/
// note: In pre(++x) increment fist increse value than put value
// note: In post(x++) increment first use given value and then increase the value
int a = 4, x;
x = ++a + a++ + ++a + ++a;
System.out.print(x);
}
}