Java Blitz Learning Day2

Source: Internet
Author: User

It's a good omen to sleep for only 6 hours, to wake up naturally and not be sleepy, and to continue studying Java.

One, 8 basic data types

Integers: Byte, short, int, long

Floating point number: float, double

Other: Char, Boolean

The first letter lowercase is the basic type, uppercase is the class (not all have the corresponding class)

As you can see, there is no string ... So I usually have to get a string of strings to use the class

Second, constant

Java uses final,c# to be const or readonly

Third, console output

Java:System.out.print ("Output")/System.out.println ("Output");

C #: Console.Write ("Output")/Console.WriteLine ("Output");

But C # still Console.readkey (), otherwise you won't see the result

Four, digital literal

The back plus L means long, and the front plus 0 means 8, and 0x means 16 binary.

float a = (float) 3.14;  // The default is double, to explicitly convert double b = 3.14; float // to use the F means float

This is the same in C # (usually not noticed ...). )

Java 7 can also be int x = 1_234, equivalent to int x = 1234

On the integer, there is a pit, the default "= =" is used for -127~128,

>=128 There is no way to compare directly with = =, because this is the Java bottom design, more than 128 of the integer wrapper class is not to use the object pool, then you have to show the Intvalue () and then use = = Comparison
int a=200; int b=200; System.out.println (a//trueinteger c=200; integer d=200; System.out.println (c//false

V. Expressions, operators, assignments, self-increment/subtract (++x or x + +), comparison operators, logical operators, operator precedence, string operations

Basic and C # are consistent, note that if the right side is a complex expression, the right expression value is evaluated first with *= and/= (as in C #)

int a =n; int b = 2= A/b + 1;  // 7  /= b+1;  // 2 System.out.println (a);

Java Blitz Learning Day2

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.