1.1.1Java Fundamentals-Basic concepts

Source: Internet
Author: User

Write in front: say some ashamed, from writing the first Java program to now, has been a year, but has not written blog, today finally to open the first article, the following are some of my personal understanding of the summary, may be some understanding is not in place, hope to understand, if you can point out, very grateful

What is 1.JDK? What is a JRE?

Jre:java Runtime Environment

  The Java Runtime environment, which contains the Java virtual machine, the Java base Class library. is the software environment required to run programs written in the Java language

Jdk:java Development Kit

The Java SDK, which includes the Java Runtime Environment, Java tools, and the Java base Class library.

So, in layman's terms, the JRE is the environment in which Java programs run, with this you can run the program, and the JDK is the tool for development, which is used to write programs.

2. What is a class? What is an object?

  A collection of entities with some of the same characteristics is a class, which is an abstract concept, and an object is an entity; for example, a human being is a class that refers to a concept that describes a human trait, whereas an object is an entity with these characteristics, and a person is an object.

3. How do I define a Java class?

  We might as well take a look at an example

public class humam{//class declaration//Name String name;//Gender string sex;//age int age;//address string addr;//Get name public string GetName () {      return name (); System.out.println ("The name is" +name); }//work method public void work () {System.out.println ("I am working");} Eat method public void Eat () {System.out.println ("I'm Eating");}}

above we define human this class, where class is the keyword of the class, human is the name of this class, general capitalization begins.

Public is declaring that the class is common, that a file has only one public class, and that the filename is the same as the type, that is, the above class can only save the file name Human.java, note that Java is case-sensitive.

so the defining form of the class: [public modifier] class class name {}---->publicClass Human () {}

  There are name (name), sex (gender), these data elements are called attributes

The GetName, eat and work three methods are also defined in the above class

4. What is a property? How do I define a property?

The data element used to describe an object is called an object's property, and the data contained in the definition of the class is called a property.

Global Properties  : [permission modifier] [static] Data Type property name [= value]; ---->publicstatic String name = "Sala";

Static modifier, this can be used first

Local Properties : Data Type property name [= value];---->int age = ten;

The above name,sex,adress is the attribute, the name of the property is generally lowercase

5. What is a method? How do I define a method?

An action on an object's properties is called a method of an object

Definition method : [permission modifier] [static] return type method name (parameter type parameter property name [, parameter type parameter property name]) {}

----> Public String getName (int studentid) {}

Method can not pass parameters, the above three examples are no parameters passed in, method naming is generally lowercase

First of all, thank you can see here ~ I think you may be a beginner, that I based on personal experience to tell beginners to pay attention to two points

1. Code format, the main is indentation, do not feel unimportant, the format of the code to let people have a look down the desire, and neat to look at the comfortable

2. Note, I did not pay attention to the beginning, I think there should be comments, but often write to forget, so to start to develop good habits ah

The first blog post is here first!

1.1.1Java Fundamentals-Basic concepts

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.