Operators for Java

Source: Internet
Author: User

In fact, Java is almost identical to the C operator.

1. Relational operators

 Public classLaal { Public Static voidMain (String args[]) {if(5>2) System. out. println ("return Value:"+(5>2)); if(true) System. out. println ("Hello java!"); if((3+6)==(3-6) ) System. out. println ("I like java!"); }}
Return value:trueHello java!

2. Increment and decrement operators

 Public classTest { Public Static voidMain (String args[]) {intA =3, B =3; System. out. Print ("A ="+a); System. out. println (", a++="+ (a++) +", A="+a); System. out. Print ("B ="+C); System. out. println (", ++b="+ (++B) +", b="+b); }}
3 , a++=3 , a=43 , ++b=4 , b=4

3. Logical operators

 Public class Logic {        publicstaticvoid  main (String args[]) {            int a = ;                    if ((a<0) | | (a>100))                System.out.println ("The data entered is wrong!") );             if ((a<60) && (a>49))                System.out.println ("Prepare for the retake!") ");       }}
Prepare for the retake.

Operators for Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.