- November 24, 2020
- saptrxuy_learnit
- 0 Comments
- 1394 Views
- 0 Likes
- Hibernate, Java
First Introduction To Operators In Java
By Thriveni
1. Introduction
2. main class
3. initialize a value
4. adding 1 value
5. substracting -1 value
6. adding +9 value
7. assigning conditional value
8. adding a and b values
1.Introduction▲
using Some Operators adding and substractions
2.main class▲
2.1.Code▲
10://200 package name 20:package xv.training; 30: 40:// main class 50:public class SomeOperators { 60: 70: //main method 80: public static void main(String[] args) { 90: 390: } 400: 410:} 420:
3.initialize a value▲
3.1.Code▲
90: 100: //300 initialize a value 110: int a = 30; 120: System.out.println(" a = " + a); 130:
3.2.Output▲
a = 30 a = 31 a = 30 a 39 b = x 39x c = 39x
4.adding 1 value▲
4.1.Code▲
140: 150: //400 adding 1 value 160: a++; 170: System.out.println(" a = " + a); 180:
5.substracting -1 value▲
5.1.Code▲
190: 200: //500 substracting -1 value 210: a--; 220: System.out.println(" a = " + a); 230:
6.adding +9 value▲
6.1.Code▲
240: 250: //600 adding +9 values 260: a+=9; 270: System.out.println(" a " + a); 280:
7.assigning conditional value▲
7.1.Code▲
290: 300: //700 assigning conditional value 310: String b = a < 42 ? "x" : "y"; 320: System.out.println(" b = " + b); 330: System.out.println(a + b); 340:
8.adding a and b values▲
8.1.Code▲
350: 360: //800 adding a and b values 370: String c = a + b; 380: System.out.println(" c = " + c);
Leave a Comment