Java,java Data types

Source: Internet
Author: User

1. Java Development Kit Java SDK (contains many of our Java Runtime Libraries)

(1)JRE:Java Runtime Environment Java run-time environment

(2)Java: Development language

(3)Eclipse: Development tools myclipes idea

2, the class name to be the same as the file name to unify string s must be uppercase

Write a Java program output Helloworld

public class helloworld{

public static void Main (string[] args) {

System.out.println ("Helloworld");

}

}

The term of a program comes from life, usually the process of accomplishing certain things and things.

Java domain

Javase to do standard development

Java EE does server-side

Javame doing small-scale software development

Developing the application on the left

Developing programs on the internet side

Print ("") has no line-wrapping effect

println ("") has a line break effect

Program:

public class Helloworld {

public static void Main (string[] args) {

System.out.println ("Helloworld");

System.out.println ("Helloworld");

System.out.print ("Helloworld");

System.out.println ("Helloworld");

}

}

Operation Result:

Helloworld

Helloworld

Helloworldhelloworld

Java specification

Class names are decorated with public

One line is written with a single statement, ending with a semicolon.

Where to use {}

To indent

Write the program to achieve the following effect

public class Show {

public static void Main (string[] args) {

System.out.println ("My Name: the Prince of Tennis ");

System.out.println ("My hobby: playing tennis ");

}

}

Naming rules

Letters, numbers, underscores,$ and cannot start with numbers

Variable, attribute, method naming specification

Capital Initials -Hump rule

3. Data type

(1) basic data Types

Digital type

1, Integer type (byte, short,int,long)

2. Floating-point data type:float,double

Character type (char)

Boolean type (Boolean)

Data types are compared to the size of the storage space

BYTE, short(char),int,long,float,double

Coercion type conversions: Assigning a high-level data type to a lower-class data type must use a forced type conversion

Add the data type you want to convert before the data you want to convert

int i=768;

byte b= (byte) i;

The data type used to hold the character, takes 2 bytes, uses Unicode encoding, its first 128 byte encoding and ASCII compatible characters storage range in \u0000~\uffff, when defining the character type of data should pay attention to " , such as ' 1 ' denotes the character ' 1 ' instead of the value 1,

char c = ' 1 '; We try to output C to see,System.out.println (c), the result is 1, and if we output it System.out.println (c+0), the result becomes 49.

Java,java Data types

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.