Web-Android Engineer first form comparison operator in -3-4 Java

Source: Internet
Author: User

Source: http://www.imooc.com/code/1299

The comparison operator is used to determine the size of two data, for example: greater than, equal to, not equal to. The result of the comparison is a Boolean value (True or false).

The common comparison operators in Java are shown in the following table:

Attention, OH:

1, >, <, >=, <= only support the left and right sides of the operand is a numeric type

2, = =,! = The operands on either side of the number can be numeric types, or they can be reference types

Task

Verify your study results!

Add the correct comparison operators in the editor, 7, 8, 9, and then to achieve the following results:

1  Public classhelloworld{2      Public Static voidMain (string[] args) {3         intA=16;4         Doubleb=9.5;5String str1= "Hello";6String str2= "Imooc";7System.out.println ("A equals B:" +(a B));8SYSTEM.OUT.PRINTLN ("A greater than B:" +(a B));9System.out.println ("A is less than or equal to B:" +(a B));TenSystem.out.println ("str1 equals str2:" +(str1 str2)); One     } A}

1  Public classhelloworld{2      Public Static voidMain (string[] args) {3         intA=16;4         Doubleb=9.5;5String str1= "Hello";6String str2= "Imooc";7System.out.println ("A equals B:" + (A = =b));8System.out.println ("A is greater than B:" + (a >=b));9System.out.println ("A is less than or equal to B:" + (a <=b));TenSystem.out.println ("str1 equals str2:" + (str1 = =str2)); One     } A}

Web-Android Engineer first form comparison operator in -3-4 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.