GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — CoreJavaPrograms/src/basic002/Lab007_Operator.java at main · Divya-learn/CoreJavaPrograms

Expand file tree

/

Lab007_Operator.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
49 lines (34 loc) · 1.59 KB
/

Lab007_Operator.java

Copy path

File metadata and controls

49 lines (34 loc) · 1.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package src.basic002;
public class Lab007_Operator {
public static void main(String[] args) {
//Airthmetic operator (+,-,*,%,/) -->needs two operand (a,b)
//Urnary Operator //needs only one operand
int num1 = +10;
int num2 = -34;
System.out.println(num1 + num2);
int num3 = 67;
double num4 = 56.789; //if we add int + double gives result as double
System.out.println(num3+num4);
//String concatenation operator //adding two string
String sentence = "Note";
String sentence2 = "Book";
System.out.println(sentence + sentence2);
//Important concept interview ques:
int n1 = 30 , n2 = 40;
String name ="Jeni";
//Start from left to right.
// If there are 2 integer addition occurs.
//String +other(number) -->Concatenation occurs
/* n1+n2+name -->(start from left to right) n1 + n2 = 70 addition (2 integer addition occurs)
70+ name =70Jeni concatenation (integer + string concatenation occurs)
name+n1+n2 -->(start from left to right) name + n1 = Jeni30 concatenation (string + integer concatenation occurs)
Jeni30 +n2 = Jeni3040 Concatenation (string + integer concatenation occurs)
*/
System.out.println(n1+n2+name); // op: 70Jeni
System.out.println(name+n1+n2); // op: Jeni3040
//Compound Assignment Operator (+=, -=, *=, %=, /=)
int a1 = 10;
a1+=10;
System.out.println(a1);
}
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.