Hi everybody ,
can you guide me please what am i missing?
so i create a class called Lecturer ,this is part of the code(of the class)
private String name; private int numOfTimesPenFalls; private String favoriteIceCream; public Lecturer(String name,int NumOfTimesPenFalls,String FavoriteIceCream){ this.name=name; setNumOfTimesPenFalls(numOfTimesPenFalls); setFavoriteIceCream(favoriteIceCream);} public String toString(){ return "Name: "+name+" number of times pen falls: "+numOfTimesPenFalls+" Favorite iceCream: "+favoriteIceCream;}
and in the class i also create set's and get's methods for penFalls and IceCream..
in the main i create an object = Lecturer lec1=new Lecturer("John",4,"Vanila");
and then i check if toString method word correct = System.out.println(lec1.toString());
and here is my problem ,the output is: Name: John number of times pen falls: 0 Favorite iceCream: null
My Question is why :number of times pen falls is '0' and not 4 ? and wht iceCream is 'null'.
what did i do wrong/miss?