Package Com.text_1;public class Student {//write Java applications. First, define the class--student that describe the student, including attributes such as study number (int),//Name (String), age (int), and two methods: Student (int stuno,string name,int)//For initializing an object, Output () is used for outputting student information. Next, define a main class--//testclass, create multiple objects of the student class in the main method, use these objects to test//test the function of student class. int stuno,age; String name; Student (int stuno,string name,int age) { This.stuno=stuno; This.name=name; this.age=age; } void OutPut () { System.out.println ("Number:" +this.stuno+ "\ n" + "Name:" +this.name+ "\ n" + "Age:" +this.age); } public static void Main (string[] args) { student stu=new student (28, "Zhang San", N); Stu.output (); }}
Java Object-oriented practice student information output