Basic Java Learning Chapter 01

Source: Internet
Author: User

Engaged in the java2 years of development, and later found themselves in addition to the online copy of the code is useless, not in the school when the child is also willing to take the time to study new technology, even the most basic is not commonly used to quickly forget.

So start again from the very beginning of the first review, write some blog to record their learning process.


Java Basic syntax

1. Output error and debug information

The System class is a final decorated class that cannot be inherited and has no subclasses . cannot be instantiated because the construction method is private.

Package Name: Java.lang The description of the package is: Provides a basic design for the Java programming language. Fully qualified class name: Java.lang.Object


2. Receive a string that controls too much input

System.in the "standard" input stream.

System.out "standard" output stream.

Use scanner Scanner to encapsulate system.in

The scanner class is a final decorated class that cannot be inherited and has no subclasses.

Package Name: Java.lang Help Document Description: A simple text scanner that uses regular expressions to parse primitive types and strings.


code Example 1

Java.io.bufferedinputstream;java.io.bufferedreader;java.io.ioexception;java.util.scanner;        test{Main (string[] args) {Scanner scanner=scanner (System.);        String instring= scanner.nextline (); System:    printf (, instring); }}

code Example 2


com.dome; Java.io.bufferedinputstream;java.io.bufferedreader;java.io.ioexception;java.util.scanner; Test{    main (String[] args)     {        bufferedinputstream buferinput=bufferedinputstream (System.);        [] bytes=[];        {             buferinput.read (bytes,,bytes.);             system. printf (, java.lang.String (bytes));        }  (ioexception e)  {            e.printstacktrace ();         }    }} 

Auto-conversion and casting in 2.java

Description: There are two conversion methods for type conversion and casting between Java's basic data types.

Java Basic data types

The variable in Java is the application of memory space to store data. When creating variables, you need to request space in memory, and content management requests memory space based on the type of the variable.

So you can store integers, decimals, and characters based on different types of variables.

Built-in data types

Reference data type

The byte data type is a signed 8-bit data type, an integer expressed in twos complement, a minimum value of -128 ( -2^7) 127 (2^7-1), and 2 of 7 Squares

Short data type 16-bit data type 2 for 16-time-square

int data type 32-bit data type

Long data type 64-bit data type
















This article is from the Java Learning Route blog, so be sure to keep this source http://9794875.blog.51cto.com/9784875/1917525

Basic Java Learning Chapter 01

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.