Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.spec.model;
- public class Student {
- private String name;
- private int age;
- public Student(String name, int age) {
- this.name = name;
- this.age = age;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getAge() {
- return age;
- }
- public void setAge(int age) {
- this.age = age;
- }
- //переопределяем метод toString класса Object (method overriding - переопрделение метода)
- @Override
- public String toString(){
- return "name=" + name + "_age=" + age;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement