System.out.println("Hello " + name + " and welcome to your doom."); System.out.println("I will continue to say " + name + " because I can and it is fun..." + name + "."); System.out.println("I like you " + name + ". Let's be friends. :D");
@lightfr3edom String[] is stating the type and that it is an array, args is just the variable name. it could be String[] beans , as the args part is just a name.
@lightfr3edom "String[] args" is an empty array declaration. If you learn about array declaration, you will learn that placement of the brackets doesn't make a difference, so long as the "[]" doesn't come before the array type (String in this case).
@lightfr3edom They mean and do the same thing, except that if you ever get into Java game development, the second one will throw errors. So always use String[] args.
In case of the variable "name" at 1:20, can I put that variable inside the body of the method (between { } ) instead to put in parameters (in this case simpleMessage()), in other words to leave it blank ?
A good advice to help yourself remember: Type // and enter your notes on the same line, so you can keep track on what the various things are doing. The compiler will ignore anything that comes after //, so only us puny"humans" can read it.
I am getting IT as my course,but honestly I'm getting difficulties of making program.thanks you very much for this video because it helps a lot. Post more video about programming.
@COD5252 Say you're part of a programming team. One guy writes a class that does calculations, while you work on the gui. Rather than copy and paste his code into your program, you use parameters to make calls to his class (in a seperate file) so you don't step on each others toes. It also allows you to talk to other classes through Interfaces (getters and setters) without knowing the underlying code of the other guy's class. This is how most development companies work. Basically; it's important
@c4stoners yeah idk why either, I just put it the way he USED to put it earlier, besides in al the java books I've seen they type it "public static void main(String args[]) ....so idk why he did that >.<
@c4stoners "String[] args" is an empty array declaration. If you learn about array declaration, you will learn that placement of the brackets doesn't make a difference, so long as the "[]" doesn't come before the array type (String in this case).
I did everything as bucky did but in vid 14 i named it multipleclasses and multipleclasses2 not apples and tuna.
Now here i named them MethodsWithParameters and MethodsWithParameters2 but when i run the box pops up with would you like to run...
MethodsWithParameters
MethodsWithParameters
i click run and it says in the box where it runs it "terminated multipleclasses" so is it not running MethodsWithParameters and MethodsWithParameters2
@niccomaker a method with something within its parenthesis requires the outside method to send in a value. example -
public void addOne(int x){ x++; System.out.println(x);
}
this means, that in order to access this method, you must include an int for it to function. in otherwords, to access this method, you will use a line of code such as:
object.addOne(5);
this line will send in a value of 5 to the addOne method, which will then add one to that number and print it. hope i helped
@niccomaker argument is just the stuffyou want to send from one class to another. like from a class he named apples to a class he named tuna. it can be a number(int or double or for example) or a word(string) or whatever. argument is just the stuff you wantto send.
I know that you are teaching us java, but after learning a bit, i think your "exercises" Are a bit uneffecient, mostly because we could do all of this on one class just using what we learned from your 8-10 tutorial. Iwish you made an exercise that would REQUIRE another class instead of legnthening it up.
@imkoreandontmess String name is saying that the variable "name" is going to be a string of text, where it equals the Scanner object thing "input" (using this allows us to type things so we can assign it to the variable "name") and .nextLine(); is telling the program to move on to the next line after you input whatever it is you assigned to the variable "name"
@noogai132 ahhh, thank you :)! So if I understand correctly, String is for text rather than numbers? We are assigning a string of text variable called "name"?
@Alaynia100 Well, I suppose you could also say it's for a string of characters, where numbers could also be put in, but I'm not entirely sure myself. I'm still learning Java from TNB, but I have a bit of experience with programming in the past, mostly from Python. But I'm just saying what I've gathered from actually looking at the program.
I learned a lot from your videos , can you please help me with "RECURSION" ???because I'm working on that and getting a hard time to understand that....
I realized that in previous lessons, you put parenthesis after "args." For example, public static void main ( String args() ) . In this lesson, you have put it after "String." What is the difference?
This is required for the simpleMessage method, because it will print the variable "name", if you don't put any value for the variable "name", then the simpleMessage method won't print anything.
public class tuna{ public void calculator(){ Scanner circle = new Scanner(System.in); double PI = 3.14; double radius, area,circ; System.out.println("What is the radius of the circle? "); radius = circle.nextDouble(); area = PI*radius*radius; circ = 2*radius*radius; System.out.println("The area of the circle is: "+area+" and the circumference is: "+circ); }
@ChrisTheBest1992 yes you can declare any variables within a method, and they will survive for the life of the scope of that variable as you would expect, good luck with future endevours :)
class Test { public static void main(String[] args) { Scanner input = new Scanner (System.in); tuna tunaObject = new tuna (); System.out.println("What's your favourite fruit?: "); String name = input.nextLine(); tunaObject.simpleMessage(name); }
}
public class tuna { public void simpleMessage(String name){ System.out.println("Great! I like " + name + " too!"); }
@borsxo you can have multiple methods in one class, lemme try using picture to describe them as i understand it... the class is the paper, the methods are different drawings on that paper, might not be the best way to describe it but...
If you're using eclipse you can save time by going ahead and typing the code with scanner. Then you can click it, and there is an option to import it so you don't have to type the import out every time. It saves time on simple tasks like this.
import java.util.*; imports every utility :) Just good for newbies like me and all you guys (I think) so we dont have to worry about importing the right utilities every time!
@samratmazumdar The ^ is pointing at the "tuna" thus I would assume that something is wrong with the tuna variable/ class/ object. Maybe check your code again for any little typos.
I would recommend you to switch to Eclipse. I in the beginning also used TextWrangler and Terminal to do all the stuff but Eclipse is really much better when it comes to different classes and stuff...
@AreusAstarte I figured out the issue, instead of writing "System.out.println("Hello "+ name);" I wrote "System.out.println("Hello " + name);". Gave a extra space in between "+".
@seksigapanda no, it wont mess with it, its just that if EVERYTHING was imported, things would act slower, so by only taking what you need, when u need it, your program will be more efficient
however, just having one lousy util imported at all times wont make a difference a human can see, so thats fine
I made mine say this:
System.out.println("Hello " + name + " and welcome to your doom."); System.out.println("I will continue to say " + name + " because I can and it is fun..." + name + "."); System.out.println("I like you " + name + ". Let's be friends. :D");
cubesquaredtothe1 1 day ago in playlist Java (Beginner) Programming Tutorials
can you have multiple parameters?
Frogfish999 1 day ago
@Frogfish999 yea just seperate them with a comma. try it out
N1G3L2 1 day ago
This video is a life saver. Seriously. Here's a blank cheque. Write any figure on it.
MageMayu 5 days ago in playlist Java (Beginner) Programming Tutorials
@heatoneGR eeeee gia na ftia3w kamia malakia
ClanNGOG 5 days ago
Your tutorials are awesome!!
VirtualSpoof 6 days ago
This video is helping me figure something out that I've spent almost a full 4 hours trying to troubleshoot.
paintbaiijnk3 1 week ago
I feel like i just made Skynet after doing this!
tteeexx 1 week ago
What is the difference between
public static void main(String[] args){}
and
public static void main(String args[]){}
lightfr3edom 1 week ago 10
@lightfr3edom String[] is stating the type and that it is an array, args is just the variable name. it could be String[] beans , as the args part is just a name.
PteBBQ 1 week ago
@lightfr3edom its same
TheIslamiq 1 week ago in playlist Java (Beginner) Programming Tutorials
@lightfr3edom nothing i think
chiko1222 1 week ago
This has been flagged as spam show
@lightfr3edom "String[] args" is an empty array declaration. If you learn about array declaration, you will learn that placement of the brackets doesn't make a difference, so long as the "[]" doesn't come before the array type (String in this case).
MageMayu 5 days ago in playlist Java (Beginner) Programming Tutorials
@lightfr3edom The first one is correct, while the second one would just trigger a compiler error therefore causing it not to compile.
Pr3fixProducts 3 days ago
@lightfr3edom Nothing actually, some books document it one way and some in another.
mattxrb25 2 days ago 2
@lightfr3edom They mean and do the same thing, except that if you ever get into Java game development, the second one will throw errors. So always use String[] args.
Thumbs up so people can see!
ThePhisherman47 1 day ago
@lightfr3edom I dont think there is I use both and my programs work fine
daytdog 17 hours ago
i am 14 years old and greek that guy HELPED ME FCKING LOT
ClanNGOG 2 weeks ago
@ClanNGOG kai giati matheneis java?
heatoneGR 1 week ago in playlist Java (Beginner) Programming Tutorials
In case of the variable "name" at 1:20, can I put that variable inside the body of the method (between { } ) instead to put in parameters (in this case simpleMessage()), in other words to leave it blank ?
nexeneris 2 weeks ago
A good advice to help yourself remember: Type // and enter your notes on the same line, so you can keep track on what the various things are doing. The compiler will ignore anything that comes after //, so only us puny"humans" can read it.
Patrick128000 3 weeks ago
I am getting IT as my course,but honestly I'm getting difficulties of making program.thanks you very much for this video because it helps a lot. Post more video about programming.
joselyn531 3 weeks ago
Hey, nice vid. Helped me on my computer science test.
SuperRumpelstiltskin 3 weeks ago
nice job!!
zigmasss 4 weeks ago
ive been watching these tutorials backwards ;p
devilazpl 1 month ago
why use methods with parameters when we can easily divert and route the main class easily without parameters to the linked class
COD5252 1 month ago
@COD5252 Say you're part of a programming team. One guy writes a class that does calculations, while you work on the gui. Rather than copy and paste his code into your program, you use parameters to make calls to his class (in a seperate file) so you don't step on each others toes. It also allows you to talk to other classes through Interfaces (getters and setters) without knowing the underlying code of the other guy's class. This is how most development companies work. Basically; it's important
MageMayu 5 days ago
Comment removed
COD5252 5 days ago
@MageMayu this question died 4 weeks ago :P
COD5252 5 days ago
This has been flagged as spam show
this is what i did
public class tuna { public void simpleMessage(String name) { System.out.println(" FUCK YOU" +name); }
}
oldskooler71 1 month ago
Comment removed
oldskooler71 1 month ago
@jakeson81798 Error cant identify (these are very helpful)! Missed the quotations " " LOL
nishantve1 1 month ago
Comment removed
MrSilentknight12 1 month ago in playlist Java Programming Tutorials
You can see us?!!?!?!?
Love these tutorials btw!
Stormrage32 1 month ago
Thanks to you Bucky Roberts
Phengphone 1 month ago
Woohoo :) Getting into the good stuff. Thanks bucky
EMBvideos 1 month ago
Bucky Roberts born to be a star!!
empeypat 1 month ago
I don't know how to do a couple stuff
empeypat 1 month ago
i used integer(int) a, except of string name but it displays tuna cannot be resolved
COD5252 1 month ago
This is the most difficult tutorial.
Aguilasinojo 1 month ago
why did the [] go after String now instead of args?
c4stoners 1 month ago 18
@c4stoners I think the correct way is to have it after string as i saw in my first class today.
But it was my first class so wtf do i know.
SimKessy 1 month ago
@c4stoners yeah idk why either, I just put it the way he USED to put it earlier, besides in al the java books I've seen they type it "public static void main(String args[]) ....so idk why he did that >.<
VirtualCurry 1 month ago
@c4stoners it can go both ways,but the most popular format is after the class.
String[] args and String args[] is the same shit.
sesshoumaru3st 1 month ago in playlist Java Programming Tutorials
@c4stoners Yeah the String flag is a class that is in java lang package,so when i said class that's what i meant.
sesshoumaru3st 1 month ago in playlist Java Programming Tutorials
@c4stoners "String[] args" is an empty array declaration. If you learn about array declaration, you will learn that placement of the brackets doesn't make a difference, so long as the "[]" doesn't come before the array type (String in this case).
MageMayu 5 days ago in playlist Java (Beginner) Programming Tutorials
@c4stoners lol, that first happened in the last video :)
Frogfish999 1 day ago
tricky part started
COD5252 1 month ago
This has been flagged as spam show
WHO NEEDS COLLEGE TO LEARN PROGRAMMING, WHEN THERE IS YOUTUBE!!!!!!!!!!!!!!!!!!!!!
xXCrypticalCodexX 1 month ago in playlist More videos from thenewboston
What contest?
NICKcoolize 1 month ago
Question to anyone who can help.
I did everything as bucky did but in vid 14 i named it multipleclasses and multipleclasses2 not apples and tuna.
Now here i named them MethodsWithParameters and MethodsWithParameters2 but when i run the box pops up with would you like to run...
MethodsWithParameters
MethodsWithParameters
i click run and it says in the box where it runs it "terminated multipleclasses" so is it not running MethodsWithParameters and MethodsWithParameters2
bluetooth1020 2 months ago
@bluetooth1020 also if i do open>class it shows everything except multipleclasses, MethodsWithParameters, and MethodsWithParameters2.
i tried closing and re-opening but it doesnt work still please help ty
bluetooth1020 2 months ago
i wish i can follow this right :P
i have to add my own little tiny stuff :P
0MARATION 2 months ago in playlist Learning Java
so what can you do with java
DCM0Dz 2 months ago
I don't get the argument part. Anyone willing to explain?
niccomaker 2 months ago in playlist Java Programming Tutorials
@niccomaker a method with something within its parenthesis requires the outside method to send in a value. example -
public void addOne(int x){ x++; System.out.println(x);
}
this means, that in order to access this method, you must include an int for it to function. in otherwords, to access this method, you will use a line of code such as:
object.addOne(5);
this line will send in a value of 5 to the addOne method, which will then add one to that number and print it. hope i helped
DKeller4113 2 months ago in playlist TheNewBoston - Java Programming
@DKeller4113 Thanks.
niccomaker 2 months ago
@niccomaker argument is just the stuffyou want to send from one class to another. like from a class he named apples to a class he named tuna. it can be a number(int or double or for example) or a word(string) or whatever. argument is just the stuff you wantto send.
wtfucrazy 2 months ago
Comment removed
OCoptimusconvoy 2 months ago in playlist More videos from thenewboston
dimple message
Janac 2 months ago
damn this is the first video I got lost in :/
MrStropwen 2 months ago
3:49 he say "hello name"....(to me tat's petty funny,hahaha)
KimuraSetsuna 2 months ago
thank you^^
chaiyaram 2 months ago
what is a reason to define public variables and methods inside tuna. Because tuna is already public type. Any specific reason?
sabdaphp 2 months ago
This has been flagged as spam show
Dude, you're saving my life in AP computer science. Thanks a million!
BellaFrancesca2013 2 months ago
thanks for the help everyone :) the problem was that i declared my scanner" keyboard" not "input" everyone was very helpful
bloodhunterz 2 months ago
Comment removed
bloodhunterz 2 months ago
@bloodhunterz instead of input you put keyboard because thats what you named Scanner
O_O
hahahakebab 2 months ago in playlist Java Programming Tutorials
String name = input.nextLine();
"input" is underlined red and wont work, why?
please help
bloodhunterz 2 months ago
@bloodhunterz have you called your scanner named it input by putting the line:
Scanner input = new Scanner(System.in);
so 'input' is the NAME of the scanner variable.
YavuzAliriza 2 months ago
@YavuzAliriza thanks that really helped :)
bloodhunterz 2 months ago
@bloodhunterz Are you sure you declared Scanner input = new Scanner(System.in);?
xero907 2 months ago
For line 9 and 10 could you not just write name=JOptionPane.showInputDialo("enter name here:"); ???? help pls tanks
TheN1H1LL 2 months ago
c++ is so much easier
cout<<"Hello "<<name;
PaladinMaster37 3 months ago
Comment removed
PaladinMaster37 3 months ago
Whoops... I went from lesson 14, to Intermediate lesson 15.. No wonder it didnt make sense lol. Back on track now :)
Must be another 400 videos for me to watch then lol
CorporateSilverback 3 months ago 58
I think I'm in pritty good shape. I'm doing these because i want to learn to make a simple game such as one of noch's minigames he makes in 24hrs
shipmaster4000 3 months ago in playlist Java Programming Tutorials
@shipmaster4000 42 hours. :)
jamalaron 2 months ago
@jamalaron Still thats better then me making a window in 5 weeks :P
shipmaster4000 2 months ago
something I wonder about, when should i use { and when should I use ;?
FrosenYoghurt 3 months ago
Man i love you and yo videos,, my teacher teaching game is weak , yours is not
badboyj7 3 months ago
@thenewboston
I know that you are teaching us java, but after learning a bit, i think your "exercises" Are a bit uneffecient, mostly because we could do all of this on one class just using what we learned from your 8-10 tutorial. Iwish you made an exercise that would REQUIRE another class instead of legnthening it up.
RosenShock 3 months ago
XD Everyone look how the number of views decrease as the video number increases XD
Shows how many people "really" are learning java XD
RosenShock 3 months ago 32
@RosenShock Actually, a few videos ago it was 200k, this one has 250k.
Bradstuffer 1 month ago in playlist Java Programming Tutorials
@RosenShock now make a java program where you input the video number and it ACCURATELY prints the view numbers XD
TheViolinCalamity 2 weeks ago in playlist Java (Beginner) Programming Tutorials
what does String name = input.nextLine (); mean?
i know how it works but does that mean tat watever we put for input for the first one it will use on next line?
imkoreandontmess 3 months ago
@imkoreandontmess String name is saying that the variable "name" is going to be a string of text, where it equals the Scanner object thing "input" (using this allows us to type things so we can assign it to the variable "name") and .nextLine(); is telling the program to move on to the next line after you input whatever it is you assigned to the variable "name"
Well, something along those lines, anyways. :]
noogai132 3 months ago in playlist More videos from thenewboston
@noogai132 ahhh, thank you :)! So if I understand correctly, String is for text rather than numbers? We are assigning a string of text variable called "name"?
Alaynia100 3 months ago in playlist Java Programming Tutorials
@Alaynia100 Well, I suppose you could also say it's for a string of characters, where numbers could also be put in, but I'm not entirely sure myself. I'm still learning Java from TNB, but I have a bit of experience with programming in the past, mostly from Python. But I'm just saying what I've gathered from actually looking at the program.
noogai132 3 months ago
Enter your name here:
Nurse
Hello Nurse
888chilly 3 months ago in playlist Java Programming Tutorials
I learned a lot from your videos , can you please help me with "RECURSION" ???because I'm working on that and getting a hard time to understand that....
23saadb 3 months ago
Body you=everyone.You;
you.Browser.GoToTop();
Listen4Free 3 months ago
i have a class file for each tutorial,so i can go back and look at them :)
chrisall76 4 months ago in playlist java tutorials
@kile392jr1 Er herm, that would be "FUCK YOU".
xero907 4 months ago
@xero907 u just pwned him lol, he tried to enter a non-existant variable
itsjustthecause 4 months ago in playlist Java Programming Tutorials
TUNA
MyMapleStoryMushroom 4 months ago
This video is incredibly helpful.! Thank you.
I get more out of this video thatn I did in my own class room.
terezacuriel 4 months ago
thums up if ur watching this in 2011
10293847565846800 4 months ago
@10293847565846800
Should we really care about the date?
ageofempires2fan 4 months ago
@10293847565846800 lol fail...
onelerv1 4 months ago in playlist More videos from thenewboston
Thank you very much! this finally gave me an understanding of what the hell an argument is =]
DarkHentaiDragon 4 months ago
@DarkHentaiDragon love the username.
JKTCGMV13 4 months ago in playlist More videos from thenewboston
@kile392jr1 **System.out.println(you + " ARE FREAKING STUPID");
xero907 4 months ago
Exactly. Java is for 10 yrs old shits like cakefactoryy
iferio 4 months ago
Thumbs up if your here because of minecraft.
cakefactoryy 4 months ago 2
Anyone know how to get eclipse to auto write out imports? It would just save a lot of time if you use a few of them
AJLogan1 4 months ago in playlist Java Programming Tutorials
I realized that in previous lessons, you put parenthesis after "args." For example, public static void main ( String args() ) . In this lesson, you have put it after "String." What is the difference?
love2CUsmile86 4 months ago in playlist More videos from thenewboston
@love2CUsmile86 they're brackets not parenthisis. There is no actual difference, it's an array so it doesnt matter where you put []
xero907 4 months ago
Does it make difference if you put the [ ] after or before the args in String [ ] args ?
FunkinJam 4 months ago
@COGSniper omg i love you! makes this so much easier!
NewNormandieMCServer 4 months ago
u make me want tuna
jennahei 4 months ago
type "syso" (no quotation marks, just syso), and press CTRL + Space. Your welcome.
C0GSniper 4 months ago in playlist Java Programming Tutorials
i subbed
TheModernKillcam 4 months ago
woman womanObject = new woman();
Objectifying women :D
xero907 5 months ago 53
@xero907
>> woman cannot be resolved to a type <<
does not work :(
BigTentacleEnt 4 months ago
@BigTentacleEnt public class woman{
public void clean(){
System.out.println("BUY ME MORE JEWELERY!");
}
}
... :D
xero907 4 months ago
@xero907 You sir, made my day great!
NorwayHack 2 months ago
@NorwayHack I'm glad to know that.
xero907 2 months ago
@xero907 you wish woman were so easy to :P
Geni8itoFos 2 months ago
@xero907 you wish women were so easy to handle :P
Geni8itoFos 2 months ago
@xero907 I hate myself for laughing at this xD
Kjellemann2k 2 months ago
@Kjellemann2k You shouldn't :P
xero907 2 months ago
@xero907 shouldn't treat a woman as an object. Thats being a player.
kickman199811011 2 months ago
there is no point to make tuna, you could just make it in the same class, it just makes it more organized
TheLandFerry 5 months ago
So great tuts man!
kristjanmik 5 months ago
i dont understand
tunaObject.simpleMessage(name);
i dont understand why you need name in the parameters
OtakuDachi 5 months ago in playlist Java Programming Tutorials
@OtakuDachi
This is required for the simpleMessage method, because it will print the variable "name", if you don't put any value for the variable "name", then the simpleMessage method won't print anything.
chinrxn 5 months ago
import java.util.Scanner;
public class tuna{ public void calculator(){ Scanner circle = new Scanner(System.in); double PI = 3.14; double radius, area,circ; System.out.println("What is the radius of the circle? "); radius = circle.nextDouble(); area = PI*radius*radius; circ = 2*radius*radius; System.out.println("The area of the circle is: "+area+" and the circumference is: "+circ); }
}
tris10n 5 months ago in playlist Java Programming Tutorials
Your bad ass!
joelmora2582 5 months ago
thanks!
dutchwowerke 5 months ago
Instead of Scanner, can you use JOptionpane.showInputDialog(); from javax.swing.* ?
calleg 5 months ago
This tutorial was pretty hard :o
tho I'm ready for the next one :)
ty
ProtonHazard 5 months ago
heheh
paulceltics 5 months ago
Exception in thread "main" java.lang.Error: Unresolved compilation problems: tuna cannot be resolved to a type tuna cannot be resolved to a type
WTF?!!?!?!?!?!?!?!?!?
TheMcdog2 5 months ago
Got it!
Bouncertt 5 months ago
i have a question:
in the class tune you declared a string variable into the public void stuff..
so,it is possible to declare the string variable IN THE METHOD instead?
ChrisTheBest1992 5 months ago
@ChrisTheBest1992 yes you can declare any variables within a method, and they will survive for the life of the scope of that variable as you would expect, good luck with future endevours :)
JeBuSv20 5 months ago
Friend: well vids is the most awesome way to learn
Me: no
Me: bucky is the best way
Friend: bucky?
Me: :OOO
xero907 5 months ago
System.out.println("Hello " + name + ". You're unbelievably ugly!");
EpicnessPivotMaster 6 months ago in playlist Java Programming Tutorials 49
@EpicnessPivotMaster You're trying to recreate GlaDOS? And in Java no less.
death2link 5 months ago
*eats his tuna sandwich while watching these tutorials* . no really though. im eating a tuna sandwich right now O_O
VaginosaurusRex 6 months ago in playlist Java Programming Tutorials
@nyczchimp1
You can alternate between the two. It's just creating a string array called args.
MrArfyou 6 months ago
import java.util.Scanner;
class Test { public static void main(String[] args) { Scanner input = new Scanner (System.in); tuna tunaObject = new tuna (); System.out.println("What's your favourite fruit?: "); String name = input.nextLine(); tunaObject.simpleMessage(name); }
}
public class tuna { public void simpleMessage(String name){ System.out.println("Great! I like " + name + " too!"); }
}
Gondorius 6 months ago
Comment removed
Gondorius 6 months ago
Comment removed
Gondorius 6 months ago
this takes a loooong time. i wish java was easier than this... -_-
yma3591 6 months ago
why is there a red line under my simplemessage and when i try and run it its an error?
axelGunit 6 months ago
@axelGunit in tuna class you write string not String
JustDream257 6 months ago
@JustDream257 that doesent help sorry
axelGunit 6 months ago
@axelGunit simplemessage(); Did you add the parameters?
TheKissimRunners 6 months ago
I still don't get the diff between methods and classes
borsxo 6 months ago
@borsxo you can have multiple methods in one class, lemme try using picture to describe them as i understand it... the class is the paper, the methods are different drawings on that paper, might not be the best way to describe it but...
DrTotalyLost 6 months ago
@DrTotalyLost but? Okay I get it now. Thanks! =)
borsxo 6 months ago
@borsxo but thats the best way i can describe it ^^
glad to be of use.
DrTotalyLost 6 months ago
THIS IS AMAZING! I have been trying to understand classes for MONTHS now, and I FINALLY GET IT OMGOMGOMGOMGOMGOMGOMG!!!
connbman1 6 months ago
Lol I name my class object the same name as the class so.
Tuna Tuna = new Tuna (); haha. makes it simpler.
JPxKillz 6 months ago
@nyczchimp1
Both the statements are same!!!
1993abhilash 6 months ago
If you're using eclipse you can save time by going ahead and typing the code with scanner. Then you can click it, and there is an option to import it so you don't have to type the import out every time. It saves time on simple tasks like this.
NotSansReason 6 months ago
import java.util.*; imports every utility :) Just good for newbies like me and all you guys (I think) so we dont have to worry about importing the right utilities every time!
Darthshepius 6 months ago
I am using TextMate and Terminal in my Mac but getting this error:
Samrats-MacBook-Pro:Java samratm$ javac apple.java
apple.java:10: simple() in tuna cannot be applied to (java.lang.String) tunaObject.simple(name); ^
1 error
samratmazumdar 6 months ago
@samratmazumdar The ^ is pointing at the "tuna" thus I would assume that something is wrong with the tuna variable/ class/ object. Maybe check your code again for any little typos.
I would recommend you to switch to Eclipse. I in the beginning also used TextWrangler and Terminal to do all the stuff but Eclipse is really much better when it comes to different classes and stuff...
AreusAstarte 6 months ago
@AreusAstarte I figured out the issue, instead of writing "System.out.println("Hello "+ name);" I wrote "System.out.println("Hello " + name);". Gave a extra space in between "+".
samratmazumdar 6 months ago
why in tuna tunaObject= new tuna(); it didn't show any correction or error message even if the tuna variable had been type twice?
raidenx44 6 months ago
What would I do for
Hello Name!
with the ! at the end?
public class name { public void simpmsg(String name){ System.out.print("Hello " + name); System.out.print("!"); }
}
That?
NoFatGamer 6 months ago
@NoFatGamer In the tuna class, after the "System.out.print("Hello " + name);" in the next line write:
System.out.print("!"); I just realized after typing this, that's exactly what you typed. So yeah it should work.
Thezeroaceflyz 6 months ago
@NoFatGamer
tunaObject.simpleMessage(name + "!"); works :)
Darthshepius 6 months ago
@NoFatGamer buddy, the best way is this:
System.out.println("Hello " + name + "!");
RASHTG 6 months ago
can i declare String name under public void simpleMassage instead of declaring it in open and close parenthesis?
jojosh234 6 months ago
Does anyone else just keep the Scanner imported, from tut to tut?
TzKet4m 6 months ago 74
@TzKet4m
no, becous i think that messes with the code, if you import it and don't use it.
seksigapanda 6 months ago
@seksigapanda no, it wont mess with it, its just that if EVERYTHING was imported, things would act slower, so by only taking what you need, when u need it, your program will be more efficient
however, just having one lousy util imported at all times wont make a difference a human can see, so thats fine
RazorSRaider 5 months ago
@TzKet4m - "Yes, I do" - Gabe Newell.
EpicnessPivotMaster 6 months ago in playlist Java Programming Tutorials