Java Basic Syntax

Source: Internet
Author: User

A Java program can be thought of as a collection of a series of objects that work together by invoking each other's methods. The following is a brief introduction to the concepts of classes, objects, methods, and instance variables.

Object: An object is an instance of a class that has state and behavior. For example, a dog is an object whose state is: color, name, variety, behavior: wagging the tail, barking, eating, etc.

Class: A class is a template that describes the behavior and state of a class of objects.

Method: The method is the behavior, a class can have many methods. Logical operations, data modifications, and all actions are done in a method.

Instance variables: Each object has a unique instance variable, and the state of the object is determined by the value of these instance variables.

The first Java program

Here's a simple Java program that will print the string HelloWorld

Instance:


public class HelloWorld {
/* First Java program
* It will print the string Hello World
*/
public static void Main (String []args) {
System.out.println ("Hello World"); Print Hello World
}
}

Java Basic Syntax

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.