सीधे मुख्य सामग्री पर जाएं

संदेश

#33 How to use Ternary Operator in Java ? Ternary Operater क्या होता है ?

package com.sudhirtheindian2.java123 ; public class ternary_operator { public static void main (String[] args) { // How to use ternary operator in java // syntax // (?:) (a>b>c) // find the greatest number among a,b and c int a= 2 , b= 3 , c= 400 ; int result= (a>b)?(a>c?a:c):(b>c?b:c) ; System. out .println(result) ; } }

#32 How to use Assignment Operator (=, +=, -=) in Java | Assignment Operator क्या होता है ?

package com.sudhirtheindian2.java123 ; public class assignment_operator { public static void main (String[] args) { // How to use assignment operator in java // simple assignment operator // 1 = // compound assignment operator // 2+= // 3-= // multiple value increment decrement int a= 10 ; // a+=5;// a=a+5=10+5=15 // System.out.println(a); // a-=2;// a=a-2=10-2=8 // a=a-2; System. out .println(a) ; } }

#31 How to use Increment / Decrement in Java | Increment /decrement operator क्या होता है ?

package com.sudhirtheindian2.java123 ; public class increment_decrement_operator { public static void main (String[] args) { // How to use increment decrement operator in java // increment or decrement one value only // increment operator // 1 pre increment ++a // 2 post increment a++ // decrement operator // 1 pre decrement --a // 2 post decrement a-- int a= 10 ; // System.out.println(++a); // System.out.println(a++); // System.out.println(a++); // System.out.println(--a); System. out .println(a--) ; System. out .println(a--) ; } }

#30 How to use logical operators in Java | Logical Operator(&& ,|| and ! ) क्या होता है ?

package com.sudhirtheindian2.java123 ; public class logical_operator { public static void main (String[] args) { // How to use logical operator in java // 1 && logical and operator // 2 || logical or operator // 3 != logical not operator int a= 5 , b = 10 ; // System.out.println(a==b && a>b); //5==10 5>10 // System.out.println(a==b || b>a); // 5==10 10>5 System. out .println(!(a==b) || a>b) ; } }

#29 How to use Relational Operator in Java | Relational Operator क्या है ?

package com.sudhirtheindian2.java123 ; public class relational_operator { public static void main (String[] args) { // How to use relational operator in java // 1 == // 2!= // 3> // 4< // 5<= // 6>= int a = 5 , b= 10 ; System. out .println(a==b) ; //5==10 System. out .println(a!=b) ; //5!=10 System. out .println(a>b) ; //5>10 System. out .println(a<b) ; //5<10 System. out .println(a<=b) ; //5<=10 System. out .println(a>=b) ; //5>=10 } }

#28 How to make a Calculator in Java ? Java में Calculator कैसे बनायें ?

package com.sudhirtheindian2.java123 ; import java.util.Scanner ; public class calculater { public static void main (String[] args) { // How to make a calculater in java language int a , b , c , choice ; System. out .println( "enter two number" ) ; Scanner scanner = new Scanner(System. in ) ; System. out .println( "enter your first number" ) ; a=scanner.nextInt() ; System. out .println( "enter your second number" ) ; b=scanner.nextInt() ; System. out .println( "enter your choice" ) ; choice= scanner.nextInt() ; switch (choice){ case 1 : c=a+b ; System. out .println( "addition " +c) ; break; case 2 : c=a-b ; System. out .println( "subtraction " +c) ; break; case 3 : c=a*b ; System. out ...

#27 What is operator in Java ? Arithmetic Operator with Calculator's example

package com.sudhirtheindian2.java123 ; import java.util.Scanner ; public class arithmetic_operator { public static void main (String[] args) { // What is operator and arithmetic operator with calculater example // operator // operator is a symbol that is used to perform // operatons according to user requirement // types of operator // arithmetic_operator // relational oprator // logical operator // arithmetic operator example int a , b , c , choice ; System. out .println( "enter the two number" ) ; Scanner scanner = new Scanner(System. in ) ; a= scanner.nextInt() ; b= scanner.nextInt() ; System. out .println( "enter your choice" ) ; choice= scanner.nextInt() ; switch (choice){ case 1 : c=a+b ; System. out .println( "addition " +c) ; break; case 2 : ...