Java Programming Tutorial – 16 – Many Methods and Instances
How to use multiple methods and also instance variables inside a class.
May 2, 2010 | Filed Under Java Tutorials
Comments
25 Responses to “Java Programming Tutorial – 16 – Many Methods and Instances”
Powered by Yahoo! Answers
Hi everyone, i have a question, for the code in line nine, is it possible to enter input.nextline() in the parameters instead of creating a string variable and then storing that variable?
eg tunaObject.setName(input.nextline());
For those having trouble with this video don’t worry. i think this is the first video in the series where he doesn’t explain things as well as he could.
google more information on getters and setters and also return methods and then come back when you understand those.
bucky i mean no offense your videos are awesome, it’s just this one confused me when i first saw it and seems to be confusing a few other people. Just wanted to let them know not to get disheartened.
you have used two to programs; apples.java and tuna.java,, is it possible to make it in just one program???
she was a babe hahaha
actually tuna.java is a sub class of apples.java..
which he showed brfore
“She was a babe!”
@paramorechuchu yes, and it would be easier. But he is just showing you how to use multiple methods from another class. which would be helpful if your writing huge programs and don’t want to confuse yourself with a shitload on just one page
This one was kinda confusing :/
lol she WAS a babe
Great tuts man , I’ve got a practical tomorrow this is saving my life !
Deffo gonna have to rewatch this 2 times x)
what is the purpose of
tuna tunaObject = new tuna();
could somebody explain it in simple terms please?
thy did he do this
public String getName(){
return girlName;
you dont realy need ya.
@PremiumZero *you dont need this
Well I am still learning but I think the purpose of tuna tunaObject = new tuna(); is to create an object of the tuna class, which you later use to have access to the methods of the tuna class. Somebody please correct me if I am wrong, but I think this is what it does.
Well I am still learning but I think the purpose of tuna tunaObject = new tuna(); is to create an object of the tuna class, which you later use to have access to the methods of the tuna class. Somebody please correct me if I am wrong, but I think this is what it does.
hi, why do you need use class tuna when you can actually use:
System.out.println(“Enter name of first gf here: “);
String temp = input.nextLine();
System.out.printf(“The name of your first gf was %s”, temp);
immediately, please explain..
thanks
@nocin1
@berttadtad Bucky’s just demonstrating the use of multiple classes, thats all.
i think its a lot more simple if you write
System.out.println(“Your first gf was ” + getName());
it has same effect :)
@kapustelis but then we wouldn’t learn about classes :p
I hv trouble understanding the ” getName ” method… can somebody plx explain this to me?
@mathozero getName – try to change this “get” any words it will work the same :)
@mouthbalz thx
kool videos thanks alot