package com.codegym.task.task05.task0508;
/*
Getters and setters for the Person class
*/
public class Person {
//write your code here
public static void main(String[] args) {
}
private String name;
private int age ;
private char sex;
public void Perosn(String name, int age , char sex) {
this.name = name;
this.age = age;
this.sex = sex;
}
public void setname(String name ) {
this.name = name;
}
public String getname() {
return name;
}
public void setage(int age) {
this.age = age ;
}
public int getage(){
return age;
}
public void setsex(char sex) {
this.sex = sex;
}
public char getsex() {
return sex;
}
}
what is this bug ?
Under discussion
Comments (5)
- Popular
- New
- Old
You must be signed in to leave a comment
Optimus2000
7 May 2020, 20:35
None of your code should be written in the main method.
They should be in the person class before the main method! the place where it says write your code here.
+1
parthasarathy t s
18 June 2019, 15:51
public class Person {
private String name;
private int age ;
private char sex;
/* public void Perosn(String name, int age , char sex) {
this.name = name;
this.age = age;
this.sex = sex;
}*/
public void setName(String name ) {
this.name = name;
}
public String getName() {
return name;
}
public void setAge(int age) {
this.age = age ;
}
public int getAge(){
return age;
}
public void setSex(char sex) {
this.sex = sex;
}
public char getSex() {
return sex;
//write your code here
}
0
Emanuele Gurini
22 March 2019, 17:33
Fady, check also line 20: "Perosn"
+1
Oleh
21 March 2019, 14:20
You need to use "camelCase" style for method`s names. Do every word (except first) start with big letter.
0
Oleh
21 March 2019, 14:25
Also you can try "alt + inset" bind for fast getters/setters
+1