-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNLecture.java
More file actions
86 lines (66 loc) · 2.25 KB
/
Copy pathNLecture.java
File metadata and controls
86 lines (66 loc) · 2.25 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import java.util.Scanner;
public class NLecture {
public static void main(String [] args)
{
/* int a;
a=5;
float b= 2.5f;
long c = 3l;
System.out.println("The value of a is: "+a);
System.out.println(b);
System.out.println(c);
char d = 'A';
System.out.println(d); */
//String
/* String name = "Omar Ali";
System.out.println(name); */
//Operators
/**
* 1. Arithmetic Operator (+,-,*,/,%)
* 2. Relational Operator (>,<,<=,>=,==,!=)
* 3. Logical Operator (&&-AND,||-OR ,!-NOT)
* 4. Assignment Operator
* 5. Ternary Operator
*
*/
int x=5;
int y =7;
int p=2;
int q=1;
/* System.out.println(x+y);
System.out.println(x-y);
System.out.println(x*y);
System.out.println(x/y);
System.out.println(x%y); */
/* System.out.println(x>y); //false
System.out.println(x<y); //true
System.out.println(x>=y); //false
System.out.println(x<=y); //true
System.out.println(x==y); //false
System.out.println(x!=y);//true */
/* System.out.println((x>y) && (p>q)); //false
System.out.println((x<y) && (p>q)); //true
System.out.println(!(x<y) || (p<q)); //false */
/* int a = 5; //assignment operator
int a == 5; // rational operator */
/**
* Input and Output
*/
/* System.out.println("Hello ZNZ");
System.out.println("Hello Computer Programming"); */
/**
* Scanner,BufferedReader,ConsoleReader
*
*/
Scanner input = new Scanner(System.in);
System.out.println("Enter your name: ");
String name = input.nextLine();
System.out.println("Enter your age: ");
int age = input.nextInt();
System.out.println("Your name is "+name+" and you are "+age+" years old");
System.out.println("Enter your best letter: ");
input.nextLine();
char letter = input.nextLine().charAt(0);
System.out.println("Your lovely character is: "+ letter);
}
}