Hey guys,
so i'm trying to learn the basics of Java, i just could not understand this code.
public class Puppy{
int puppyAge;
public Puppy(String name){
System.out.println("Passed Name is :" + name );
}
public void setAge( int age ){
puppyAge = age;
}
public int getAge( ){
System.out.println("Puppy's age is :" + puppyAge );
return puppyAge;
}
public static void main(String []args){
Puppy myPuppy = new Puppy( "tommy" );
myPuppy.setAge( 2 );
myPuppy.getAge( );
System.out.println("Variable Value :" + myPuppy.puppyAge );
}
}
now i know Python and C, so i understand basic syntex.
Could someone explain this could with deep detail? line by line?
Thanks for the help.