Java Primary knowledge

Source: Internet
Author: User
Tags float double switch case try catch

    • Standard input and output for Java:
      Output:

      System.out.print ();
      System.out.println (); More Print a carriage return
      System.out.println ("Xiao Liu Liu");
      System.out.println ("Xiao Wang Wang");

Input:

Import Java.util.Scanner;
Scanner Scanner = new Scanner (system.in);//Input Object
Scanner.close ();//Close Scanner
Scanner.nextint ();//integral type for absorbing inputs
Scanner.next ();//Absorbing strings
Scanner.nextboolean ();//Absorbing Boolean type
Scanner.nextbyte ();//absorption byte type
Scanner.nextdouble ();//absorbing double precision type
Scanner.nextfloat ();//absorption single precision type
Scanner.next (). charAt (0);//Absorbing single characters
Scanner.nextshort ();//absorbing short-integer
Scanner.nextlong ();//absorption of long plastic

    •     

      Constant
      1. Integer Constants 123
      2. Decimal constant 1.23
      3. Boolean (Boolean)-type constant true
      4. Character constant ' 1 '
      5. String constant "123 Plan on Time"
      6.NULL constant NULL

      Variable
      Why use variables
      --memory address is not easy to remember, reuse, convenient operation
      To define the format of a variable
      --Variable name of data type = initialization value;
      Identifier naming rules
      --First character: letter, underscore, ' $ ' (cannot start with a number)
      --The rest: numbers, letters, underscores, ' $ ' (-NO)


      java keyword (reserved word)
      The Java language has 51 keywords and cannot use reserved keywords to name classes, methods, or variables
      Data type
      boolean int long short byte float double Char class interface
      Process Control
      If else do and for switch case default break continue return try Catch finally
      Modifier
      Public protected private final void static STRICTFP abstract transient synchronized volatile native
      Operation
      Package import throw throws extends implements this super instanceof new
      Other
      True false NULL Goto const

    • Import Other projects

      Import->general->existing Projects into workspace
      Select the extracted project catalog->finish

Java Primary knowledge

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.