Beginner Java about variable naming common errors

Source: Internet
Author: User

SYSTEM.OUT.PRINTLN ("int a = 2.24; error, because the int type cannot have decimals");
SYSTEM.OUT.PRINTLN ("int a = 2.24f; error, int type cannot define decimal");
System.out.println ("float k = 2.24; error, fioat type number should be added F");
System.out.println ("2.24f = float k; Error, assignment rule is data type plus variable name");
SYSTEM.OUT.PRINTLN ("int A + = 1; error because a is not assigned");
SYSTEM.OUT.PRINTLN ("int a = 2.1 * 2; error, because int cannot be assigned a decimal number");
SYSTEM.OUT.PRINTLN ("int a = 5.0/2; error, int type data does not include double type data");
SYSTEM.OUT.PRINTLN ("int a = 5.0/2.0; error, int type data does not include double type data");
System.out.println ("float f = 2.0*3.0; error, float type result must end with F");
SYSTEM.OUT.PRINTLN ("int a =" 1 "+2; error, the value of a is a string and cannot be named with int");
SYSTEM.OUT.PRINTLN ("int a = (1+2) +" 3 "; error, the value of a is a string and cannot be named with int");

Beginner Java about variable naming common errors

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.