java 面向对象编程

java object oriented programming

首先我是新来的。我不知道是否有人能帮助我,但我希望有人能帮助我。 事情是我们将有一个关于面向对象编程、方法和 类 的 java 考试,当我们参加那个考试时我不在场,我刚收到一张考试图片,我对 java。我只能做一些基本的 java 代码,但我从来没有研究过那些新东西。 我们将在考试中完成 2 个任务。我会 post 下面的考试。

Task 1.
------------------------------
Class STUDENT

classvariable (private)
lastname, firstname, gender, birthyear  of student

constructor 
the 4 values will be added to the constructor.the values in the  Constructor will be assigned to the class variables.

method toString()
the data from the students (the 4 class variables) will be connected to string and stored in a variable .
Form:
Lastname: Muster
Firstname: Max
Birthyear : 1997
Gender: Male
This Variable will be returned by the Mehod.

Method outputStudentdata()
The string from the method toString() will print out.


Task 2.
-------------------------------
Class SCHOOLCLASS

Classvariable
A suitable container to store a school class with an indefinite number of students (static, Array, ArrayList ...)

Method outputClasslist()
for every student in the classroom the index number of the container and the 4 properties surname, first name, year and Gender will be output (use the method outputStudentdata() from the STUDENT Class!)

Method DeleteStudent()
You can enter the index number of the Student you'd like to delete and the student is then deleted from the container (See Default Output)

Method Classsize()
the Classsize (amount of student in  Class) is output. (See Default Output)

Method setStudent()
you can enter the last name, first name, gender and the birthyear of the new student(See Default Output)
a new object of class student will be created.
The method returns the object of the class students back.

Method Main()
Following menu will show up:

What Would you like to do?
0 > Exit
1 > Create new Student and add to Schoolclass
2 > Delete Student from Schoolclass
3 > Show Classlist
4 > Show Classsize
Enter your choice : 


You can enter your choice.
your choice will then be executed.
If you enter a not valid number(not 0 - 4), a Errormsg will appear.
The Programm will Loop until the numeric code 0 was choosen.
A message appears to Adoption

It is executed, what You have chosen. Enter a not valid number (not 0-4), an error message appears, the program is repeated until the numeric code when choosing 0 A message appears to Adoption.

我希望有人能向我解释这是如何工作的 提前致谢

请不要以为我想被喂食。 我在这里学习如何去做。 我不想这次考试不及格

Reticulated Spine 和 Gamedroids 是正确的,因为这不是适合堆栈溢出的问题。一个简单的 google 搜索就可以找到许多可用的资源。

为了帮助您入门,this tutorial 应该会帮助您处理 getter、setter 和 toString,并且您应该能够使用 google 来完成剩余的作业。