Java has been learning before, the basics are not forgotten, and these high-level languages are too similar, so those data types, or loop control flow, as well as standard equipment, and so on is just skip it.
However, some important concepts will be interspersed in the introduction of the article.
So, these articles are suitable for those who have a certain level of advanced object-oriented language basis for reading.
We first write a student class. Its main requirements to be familiar with the content is:
Understanding and understanding of class constructors (construction methods).
about how the method was written.
About the use of member variables & this,
Once we are familiar with this, we can write this class in the following class diagram.
The parameters of the constructor are name, gender, and school number.
The class diagram is as follows:
The reference code I wrote is as follows:
I've written all the attributes into the private type, because this data can write a set and get method .....
/*** description:* <br> blog:<a href = "http://suool.net" target= "Blnak" > Suool ' s Blog </a> * <br> Copyright (c), 2014-2015, Suool * <br> This program are writeen by Crazy java.* <br> program Name:student.ja VA * @author: suool* @version: 1.0.0*/public class student{///private variable privately string stu_name;private string Stu_sex;p Rivat E long stu_id;p rivate int stu_age;/*** Student Construction method * @param name construct student instance name * @param sex structure Student instance gender * @param Id Construction Student Case study Number, the beginning number is not zero */public student (string name, String sex, long Id) {this. Stu_name = Name;this. Stu_sex = sex; stu_id = Id; }/*** Set Age method * @param age to set the student's ages */public void Setage (int.) {this. Stu_age = age; System.out.println ("You set the age of the student" + this. Stu_name + ' is ' + this. Stu_age);} /*** gets the student number of the specified pupil * @return Returns the long integer number value */public long GetID () {System.out.println ("You get the ID of the student" + this. Stu_name + ' is ' + this. Stu_age); return this. stu_id;} /*** Main method * @param args command-line parameter */public static VOID Main (string[] args) {//Constructs student object Student Tom = new Student ("Tom", "Boy", 122511042); student Jelly = new Student ("Jelly", "Girl", 122511043); Tom.setage (20); System.out.println (Tom.getid ());}}
The resulting Javadoc is as follows.
Next, in the next section, write a small game, command-line version of the AI-free Gobang.
is actually the practice of arrays and standard input and output.
"If you don't make the time-to-work on creating the life you want, you ' re eventually going to being forced to spend a lot of Time dealing with a life you don ' t want. "--kevin Ngo
Java from basics to advanced learning---class authoring and documentation comments.