Java Basic-class

Source: Internet
Author: User

Java programme Beginnen in der Regel mit einer package-deklaration. Package declaration

Java Progeamme ohne package-deklaration liegen im default-package.das sollte vermieden werden!!!

Package de.meersun.javabasics;

Die optionale Import-anweisungen Import Declaration

Import java.util.*;

Klassen-deklaration class declaration

Alle Anweisungen (ausser package/import) Liegen innerhalb einer Klasse

public class firstclass{

Konstanten deklaration Constant Declaration

public static final int ust=19;

Main Methode markiert den Beginn des Programms Master method

Ausfuehrbar Anweisungen stehen immer innerhalb von Methoden

Public.static.void.main (string[] args) {

System.out.println ("hallo,xiaoyu!");

Java Bezeichner-identifier (utf-8) identifier

Bezeichner geben Dingen im Programm einnen Namen

Welche Arten von Zeichen sind in Bezeichnern erlaubt? Available identifiers

1.Buchstaben. Letters

2.ziffern-nicht zu Beginn Digital

3.verbindung_ Underline

4.Waehrungszeichen coin Symbol

Einschraenkung keine Reservierten woerte. Keyword not made identifier

int Oesterreichverwndetdeneuro;//besser mit Euro statt€

Java ist Stark typisiert-java Achtet auf Typ-kompatibilitaet

Datentypen of eight basic data types

BYTE 1 Byte-128 bis 127

Short 2 byte-32t bis +32t

int 4 BYTE-2MRD bis +2MRD

Long 8 Byte-9trl bis +9trl

Float 4 Byte ca.40 stellen

Double8 Byte ca.300 Stellen

Char 2 Byte \u0000 bis \uffff

Boolean True,false

Literal

i=042;//0 octal literal decimal

i=0x42;//0x hexadecimal literal octal

I=ob0010-0010;//ob binaeres literal binary

I=123_456;//_unterteilt ein ganzzaehliges Literal underline connection

Deklaration

int i;

Initialisierung

i=521;

Deklaration und Initialisierung zusammen

String str= "Java"; //mehrfache deklaration und Initialisierung

int x=1,y=2,z=3;

}

}

Java Basic-class

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.