Third day of Java learning

Source: Internet
Author: User

with regard to the last data conversion, if the definition is short, then s=s+1, this is wrong, will lose precision, but if it is s+=1. true, because it contains a forced conversion inside.  Equivalent to s= (int) (s+1); And then specifically see the difference between && and &, in java,&& in the judgment if the following is false, then the following conditions are not executed, such as a++&&b++; if the a++ result is 0, Then the subsequent code is not executed, because the result is wrong regardless of what is later Returned. &, on the other hand. Ternary operator, format (relational expression)? Expression 1: expression 2; if true, expression 1 is the Result. if false, the expression 2 is the Result. Finally is about the keyboard input, about those if while and so on and C C + + looked at the next, about the keyboard entry, first, is the guide package, so that I can use the input function, import java.util.Scanner; then create the object in class Scanner sc = new Scanner (system.in); Gets the data int x = Sc.nextint (); The final output is Ready.

Third day of Java learning

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.