Java from small white to getting started, Day1 (Java environment Building, declaring variables)

Source: Internet
Author: User

first knowledge of Java

The Java file name extension must be. java;

Java Cross-platform is a cross-operating system (after Java compilation is completed, A. class file is generated and can be run in the JVM.) The JVM is included in the JDK, only the JDK can be downloaded to achieve cross-platform.

Java originated in Sun (previously in c) and Sun was acquired by Oracle. James Gosling, the father of Java.

The JDK contains the JRE,JRE including the JVM. (JDK version has j2se,j2me,j2ee)

After installing the JDK, go to system properties → advanced → user variables (available only to that user), create new environment variable, variable name: Path, copy the JDK save path to the variable value and the/system variable is available to all users.

java→ compiled language (with the language of the compilation process), features: will produce the compiled file, the implementation of high efficiency, portable.

Development software Flow (waterfall): requirements → analysis → design → coding → testing. Agile: (each function point) need → code → test.

Program: An ordered set of instructions. GC: Garbage collector, which automatically eliminates program-independent data.

Java Integrated development Environment (IDE), Universal Eclipse.

declaring Variables

Number types: Byte type (byte), short Integer, Integer (int), long Integer (long), single-precision (float), double type (double).    Integer type: Byte, short, int, long. Real type: float, double.

char (character type): Represents a single literal (man, letter, number, match).  Example: ' A ', cannot be ' AA '. String (String type): Used to represent any number of characters. Example: "Abc123 hello".

Bit: Represents the smallest unit (bit) stored by the computer.

Escape with \, instance: ' \ ', means '.

Variable: Refers to an area of memory in which the data of the region can vary. Constant: Refers to an area of memory in which data in the region cannot be changed.

Declaration of a variable: Declare a piece of space in memory and prepare to hold the data. Example: int a=2; Put 2 in a.

The variable must be initialized before it can be used, that is, the variable is assigned the first time.

Identifiers: Locations in the source code that need to be named in development. Requirements: cannot have the same name as a keyword, can contain letters, numbers, underscores _,$ but cannot start with a number, and cannot have the same name as other identifiers in the same scope.

Variables three elements: type, name, value.

Print ("\ n"): Represents the newline output.

Usage of input:

Public class Input {

public static Viod main (string[] args)//main function

{

Scanner scan=new Scanner (system.in); Create a variable scan, which is used to get user input

String Str=scan.next (); Suspend the program and wait for the user's input, when the user input is completed and hit enter, the user input will be composed of a string type of data, assigned to the variable str.

System.out.print ("You have entered" +str); Represents the + input data you entered.

}

Java from small white to getting started, Day1 (Java environment Building, declaring variables)

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.