Java Object-oriented practice student information output

Source: Internet
Author: User
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

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.