Java Basics (i) Settings for environment variables, automatic type conversions, self-growth, assignment operators

Source: Internet
Author: User

How do I control the class file search path for a Java virtual device?
Set Environment variables:
pathclass= "path name"
The Java virtual device looks for the class file only in the path set by the variable.

You can set the temporary classpath variable in the command window.
Set pathclass= "path name"
. Represents the current path. To separate multiple paths.

Environment variables can be referenced by% "environment variable name"%.

How do computers communicate with humans?
The computer uses binary data to match the characters used by humans.
An ASCII code table, for example, corresponds to an English character with a two-byte binary data.

' A '//$Char(98)//b' a ' +1//98

When can the compiler automate type conversions?
The integer constant in the program is the int type by default.

byte b;b=3+4; // compiled by, the compiler checks the size of the integer constant, and automatically converts it to a byte type if it is within the byte range byte b,b1,b2;b1=3; B2=4; b=b1+b2// Precision loss Error, compiler cannot determine B1 and B2 values, operation result may exceed byte length, so error  // assigns a value to the default type (int) variable and does not check the size of the right-hand value at compile time.  int a=(int maximum value); a=a+1; // the compilation stage is correct, the operation will be error (overflow),

What is the computational process of self-growth?

int i=5; I=i++; // final Result: i=5. First establish a staging area to store the initial value of I (5),and// then perform the self-growth operation at this time, i=6,// then use the initial value of I (5) stored in the staging area for the assignment operation, and finally i=5. 

The type in the assignment operator is automatically converted.

byte b=1; b=b+1; // compilation error, precision loss error


byte b=1; b+=1; // compile normal, so write, compile will check the size of b+1, if within the byte range, automatic conversion. 

Java Basics (i) Settings for environment variables, automatic type conversions, self-growth, assignment operators

Related Article

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.