-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay_1.java
More file actions
71 lines (52 loc) · 2.34 KB
/
Copy pathDay_1.java
File metadata and controls
71 lines (52 loc) · 2.34 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
63
64
65
66
67
68
69
70
71
package Programing.Section3;
public class Day_1 {
public static void main(String[] args)
{
System.out.println("Hey there, its aarush singh here.");
int a = (10+5)*(23-3);
int b = 75;
int c = a-b;
int total = a+b+c;
System.out.println("total= "+total+" ");
int integer_minvalue =Integer.MIN_VALUE;
int integer_max_value =Integer.MAX_VALUE;
System.out.println(integer_minvalue+" "+integer_max_value);
int f= 2_147_483_647;
long M= 214748364746L;
System.out.println(f+ " " + M);
byte e=Byte.MAX_VALUE;
byte new_byte=(byte)(e / 2);
System.out.println(new_byte);
int k=Integer.MAX_VALUE;
int new_int=(int)(k / 2);
System.out.println(new_int);
byte ab=32;
short bc=21; // primitive type challenges
int i=4900;
long Longvalue= 50000L - 10L *(ab+bc+i);
System.out.println("its longvalue: "+Longvalue);
short Shortvalue=(short) (10000 - 10*(ab+bc)); // in short-type we have to use short in parathesis before operation
System.out.println(Shortvalue);
/* decimal no.s (floating point )
they have fractional parts so we use float and double to express floating point numbers
double have much larger range and precision than float......
float width is 32 while double is 64
*/
float floatmaxvalue= Float.MAX_VALUE;
float floatminvalue= Float.MIN_VALUE;
System.out.println(floatmaxvalue+" "+floatminvalue);
double doublemaxvalue= Double.MAX_VALUE;
double doubleminvalue= Double.MIN_VALUE;
System.out.println(doublemaxvalue+" "+doubleminvalue);
//string:-
String stringname = "This is aarush";
System.out.println(stringname+". Hello ALPHA");
stringname = stringname+" yoyo";
System.out.println(stringname);
stringname = stringname+" \u00A9 00:44,03/03/2022"; //u00A9 is used for copyright symbol.
System.out.println(stringname);
String stringnumber="253.44";
stringnumber= stringnumber+88; //string treats number too as text. so output= 253.4488
System.out.println(stringnumber);
}
}