Java basics video learning data types and operators

Source: Internet
Author: User
 

 

Several DOS Commands

D:

CD

CD ..

CD/

MD

Rd

Del

Exit

Start

Echo content>/> filename.txt

Sun Stanford University Network

Cross-platform

Java Virtual Machine

JVM Java Virtual Machine

JRE Java Runtime Environment

JDK Java Development Kit

Compilation tool javac.exe

Packaging tool jar.exe

Set temporary variables in DOS

Set Path =

Set classpath =

View

Set path

Set classpath

\ N: line feed

\ B: Return

\ R: Press enter. In the window system, there are two carriage return characters indicating "\ r \ n"

\ T: Tab

 

Byte: byte, which occupies 8-bit binary data. The maximum number that can be expressed is the 8 power of 2, with positive and negative values. Therefore, the value range is-128... 0... 127.

CHAR: single character type. Java uses unicode encoding to represent a single character. Unicode occupies 2 bytes (16 bits ).

Char can represent any character, including letters and numbers, and Chinese characters.

For example, char C1 = 'a ';

Char C2 = '1 ';

Char C3 = 'I ';

Because the half-width characters are special, they come from 8-bit (1 byte) ASCII code, that is, 1 byte is enough to store. In Unicode, 8-bit low (1 byte) can be used to indicate that 8-bit high does not matter. Only one byte is occupied in the memory.

Chinese uses the complete 16-bit Unicode, which occupies 2 bytes in the memory.

 

Java's string is actually the encapsulation type of char []

 

 

Short A = 4;/* automatic conversion */A + = 5;/** SHORT + int-> Int = int + int-> short = (short) int Is forcibly converted */A = (short) (a + 5 );

 

/* In the logical operators !! And! Connection and difference &: Short Circuit and |: short circuit or */public class main {public static void main (string [] ARGs) {/** & features: &: whether the left side is true or false, all operations on the right side are performed. &: When the left side is false, do not operate on the right side */int A = 2, B = 4, C = 8; if (a <2 & (B = 12)> 13) {system. out. println (integer. size);} if (a <2 & (C = 10)> 13) {system. out. println (integer. size);} system. out. println (B + "" + C);/** | and | features: |: both sides are involved in the operation |: When the left side is true, the right side is not involved in the operation */a = 2; B = 4; C = 8; if (a = 2 | (B = 12)> 13) {system. out. println (integer. size);} if (a = 2 | (C = 10)> 13) {system. out. println (integer. size);} system. out. println (B + "" + C) ;}/ * 4 1032324 10 */

 

/* In the logical operators !! And! Connection and difference &: Short Circuit and |: short circuit or */public class main {public static void main (string [] ARGs) {/*** & features: &: whether the left side is true or false, all operations on the right side are performed. &: When the left side is false, do not operate on the right side */int A = 2, B = 4, C = 8; if (a <2 & (B = 12)> 13) {system. out. println (integer. size);} if (a <2 & (C = 10)> 13) {system. out. println (integer. size);} system. out. println (B + "" + C); A = 2; B = 4; C = 8; if (a = 2 & (B = 12)> 13) {system. out. println (integer. size);} if (a = 2 & (C = 10)> 13) {system. out. println (integer. size);} system. out. println (B + "" + C);/** | and | features: |: both sides are involved in the operation |: When the left side is true, the right side is not involved in the operation */a = 2; B = 4; C = 8; if (a = 2 | (B = 12)> 13) {system. out. println (integer. size);} if (a = 2 | (C = 10)> 13) {system. out. println (integer. size);} system. out. println (B + "" + C); A = 2; B = 4; C = 8; if (a> 2 | (B = 12)> 13) {system. out. println (integer. size);} if (a> 2 | (C = 10)> 13) {system. out. println (integer. size);} system. out. println (B + "" + C) ;}/ * 4 1012 1032324 1012 10 */

JAVA input/output redirection

Method 1:

Javac main. Java

Java main <data. In> data. Out

Method 2:

Javac main. Java

Javac data. Java

Java data | Java main> data. Out

The above sentence is actually

Java DATA> data. In

Java main <data. In> data. Out

The standard output stream of data is the same as the standard input stream of main.

Double num = 0.1;

Num + num= = 0.2 true

Num + num == 0.3 false

 

 

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.