Big Data <javase + Linux Elite Training class >_day_02

Source: Internet
Author: User
Tags arithmetic

---restore content starts---

1: Basic grammarvariable variables are small boxes in memory (small containers), what are containers?variables are loaded with data! 2: Basic grammarThe smallest unit of the computer's storage unit computer storage device"Bit" (bit), also known as "bit". The smallest storage unit of a computer is called"Bytes" (byte), B.    The bytes are made up of 8 bits. 1 bytes=8 bit 1B=8b 1024B=1KB1024 =1MB 1024MB=1GB 1024GB=1TB 1024TB=1PB3: Basic Grammardata Types in Java (four classes of eight) integer types-byteNumber of bytes: 1 Range: 128 ~ 127 ShortNumber of bytes: 2 range: 32768 ~ 32767intNumber of bytes: 4 range: 2147483648 ~ 2147482648LongNumber of bytes: 8Range: floating-point-floatNumber of bytes: 4single-precision floating point-DoubleNumber of bytes: 8double precision floating point precision high character type-CharNumber of bytes: 2 can represent a character, such as: ' A ' a ' ' ay 'Boolean type-BooleanNumber of bytes: 1 only two values:true        false4: Basic Grammarconstant and type integer constants can determine the type based on the scope in which the default integer type int type is in Java. Special:2147483641L, 100L is a long type. The floating-point type in Java is double by default, and"F".

5: Three elements of variable creation, base syntax

Partition: Specify the stored data type, and name
Create three elements of a variable: type, name, data

int a= 100;

6: Base Syntax--Define basic data type variables

Code block:

 Public  classvariable{ Public Static voidmain (String [] args) {//Defining integer Types        byteb = 127;                System.out.println (b);  Shorts = 32767;                        System.out.println (s); inti = 20001002;                System.out.println (i); //define a long type        LongL = 2147483649L;                System.out.println (l); //floating-point, single-precision float        floatf = 1.0f;                System.out.println (f); //floating-point, double-precision        DoubleD = 2.2;                System.out.println (d); //character        Charc = ' a ';                        System.out.println (c); //Boolean type True false        BooleanBoo =true;            System.out.println (Boo); }}
7: Basic syntax--Definition of string variable
 Public class variable_2{    /*         string with "" "Package," 0 ~    n "*     /Public staticvoid  main (String [] args) {        //  specifies data type    name    data, Represents the type of string        s = "I love Big Data development";        System.out.println (s);    }}
8: Considerations for variable definitions based on basic syntax
 public  class   variable_3{ /*              definition and use of variables 1, after the definition of the variable, do not assign a value, can not use 2, the definition of the valid range of variables, valid range within a pair of curly braces 3. Variables cannot be defined repeatedly  */ int  a = 1;  public  static  void   main (string[] args) { int
     i = 2;    System.out.println (i); }}
 9: Conversion of data types, base syntax-> auto convert  1: Range Small Data type value ( byte ), which can be converted directly to a large range of data type values (for example: int   2: Large range data Type value (int ), cannot be converted directly to a data type with a small range (for example: byte  ) Sort by data type:  byte ->short ->int -> Long ->float ->double -& gt; coercion type conversion 
 Public class variable_4{    publicstaticvoid  main (string[] args) {            //  defines a double type variable            double i =n;            System.out.println (i);    }}
 Public classdataconvert{ Public Static voidMain (string[] args) {DoubleD = 3.14; //int i = D; //System.out.println (i); //Forced ConversionsSystem.out.println ("=========== cast ================="); inti = (int) D;                System.out.println (i); byteB = (byte) 200;                System.out.println (b); System.out.println ("=========== and pick up ========"); System.out.println ("Chinese" + "country"); }}
10: Basic GrammarThe arithmetic operator computes the symbol for the data. Operator Arithmetic Rule Example results+ Plus +3 3 + + 4 + link character String "Chinese" + "country"China-Minus signNTA = 3;-a-3-minus 3-2 1 * multiplication 2*3                    6/Division Sign 5/2 2 modulo 5%2 1 + + self-incrementintA = 1;a++/++a 2--Self-reductionintb = 3;b--/--b 2 11: Basic syntaxassignment operator operator arithmetic rule results= assigned valueintA = 1; 2 + = Plus post-assignmentintA = 3;a+=2 4-= minus value assignmentintA = 2;a-=2 0 *= passenger after assignmentintA = 2;a*=2 4/= divisible AssignmentintA = 2;a/=2 1%= modulo assignmentintA = 2;a%=2 0

---restore content ends---

Big Data <javase + Linux Elite Training class >_day_02

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.