Learn the Art and science of Java

Source: Internet
Author: User

For Java, classes are like .... Classes (the difference between objects and classes is like the "human" category and the difference between a single person). (Java class is not a function, and JS is not the same).

Java needs to create an instance in order to execute the program.

Import acm.graphics.*; Introduce a Java mapping package (cartography is like a blank sheet of paper sticking pictures {a bit like PS, probably also layered})

In Java, variables are defined, different types of data are loaded in different boxes. And JS var and let are different.

Give a chestnut: int x = 27;

Variable: {name:xy First Letter _ | | Letter//this is box X

{value:27//what ' s inside the box is a poisoned green apple

{type:int//It can only contain integers, and are always used to count

Other box type: bouble (double precision floating point), Boolean,char (characters)

About constants:

private static final bouble pi= 3.141592;

The only constant that is shared within a private class that is not changed is a double-precision floating-point number type called Pi with a value of 3.141592.

/ * When I used to learn JS, I was not quite sure why I had to shut down the packet, probably Java is more suitable for the first computer language. more systematic, so more simple * /

A class extends object by default. (Just as JS all function is Object)

Public:you can call contents inside a class from the other classes. (Kind of like in a globle scope)

Private:you can call the content is only from method inside the class.

protected : You can call the content inside of a class and its descendents

Learn the Art and science of Java

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.