Added: 2 years ago
From: thenewboston
Views: 272,336
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (594)

Sign In or Sign Up now to post a comment!
  • 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");

  • can you have multiple parameters?

  • @Frogfish999 yea just seperate them with a comma. try it out

  • This video is a life saver. Seriously. Here's a blank cheque. Write any figure on it.

  • @heatoneGR eeeee gia na ftia3w kamia malakia

    

  • Your tutorials are awesome!!

  • This video is helping me figure something out that I've spent almost a full 4 hours trying to troubleshoot.

  • I feel like i just made Skynet after doing this!

  • What is the difference between

    public static void main(String[] args){}

    and

    public static void main(String args[]){}

  • @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 nothing i think

  • @lightfr3edom The first one is correct, while the second one would just trigger a compiler error therefore causing it not to compile.

  • @lightfr3edom Nothing actually, some books document it one way and some in another.

  • @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!

  • @lightfr3edom I dont think there is I use both and my programs work fine

  • i am 14 years old and greek that guy HELPED ME FCKING LOT

  • @ClanNGOG kai giati matheneis java?

  • 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.

  • Hey, nice vid. Helped me on my computer science test.

  • nice job!!

  • ive been watching these tutorials backwards ;p

  • why use methods with parameters when we can easily divert and route the main class easily without parameters to the linked class

  • @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

  • Comment removed

  • @MageMayu this question died 4 weeks ago :P

  • Comment removed

  • @jakeson81798 Error cant identify (these are very helpful)! Missed the quotations " " LOL

  • Comment removed

  • You can see us?!!?!?!?

    Love these tutorials btw!

  • Thanks to you Bucky Roberts

  • Woohoo :) Getting into the good stuff. Thanks bucky

  • Bucky Roberts born to be a star!!

  • I don't know how to do a couple stuff

  • i used integer(int) a, except of string name but it displays tuna cannot be resolved

  • This is the most difficult tutorial.

  • why did the [] go after String now instead of args?

  • @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.

  • @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 it can go both ways,but the most popular format is after the class.

    String[] args and String args[] is the same shit.

  • @c4stoners Yeah the String flag is a class that is in java lang package,so when i said class that's what i meant.

  • @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).

  • @c4stoners lol, that first happened in the last video :)

  • tricky part started

  • What contest?

  • 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 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

  • i wish i can follow this right :P

    i have to add my own little tiny stuff :P

  • so what can you do with java

  • I don't get the argument part. Anyone willing to explain?

  • @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 Thanks.

  • @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.

  • Comment removed

  • dimple message

  • damn this is the first video I got lost in :/

  • 3:49 he say "hello name"....(to me tat's petty funny,hahaha)

  • thank you^^

  • what is a reason to define public variables and methods inside tuna. Because tuna is already public type. Any specific reason?

  • thanks for the help everyone :) the problem was that i declared my scanner" keyboard" not "input" everyone was very helpful

  • Comment removed

  • @bloodhunterz instead of input you put keyboard because thats what you named Scanner

    O_O

  • String name = input.nextLine();

    "input" is underlined red and wont work, why?

    please help

  • @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 thanks that really helped :)

  • @bloodhunterz Are you sure you declared Scanner input = new Scanner(System.in);?

  • For line 9 and 10 could you not just write name=JOptionPane.showInputDial­o("enter name here:"); ???? help pls tanks

  • c++ is so much easier

    cout<<"Hello "<<name;

  • Comment removed

  • 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

  • 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 42 hours. :)

  • @jamalaron Still thats better then me making a window in 5 weeks :P

  • something I wonder about, when should i use { and when should I use ;?

  • Man i love you and yo videos,, my teacher teaching game is weak , yours is not

  • @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.

  • 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 Actually, a few videos ago it was 200k, this one has 250k.

  • @RosenShock now make a java program where you input the video number and it ACCURATELY prints the view numbers XD

  • 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 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 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.

  • Enter your name here:

    Nurse

    Hello Nurse

  • 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....

  • Body you=everyone.You;

    you.Browser.GoToTop();

  • i have a class file for each tutorial,so i can go back and look at them :)

  • @kile392jr1 Er herm, that would be "FUCK YOU".

  • @xero907 u just pwned him lol, he tried to enter a non-existant variable

  • TUNA

  • This video is incredibly helpful.! Thank you.

    I get more out of this video thatn I did in my own class room.

  • thums up if ur watching this in 2011

  • @10293847565846800

    Should we really care about the date?

  • @10293847565846800 lol fail...

  • Thank you very much! this finally gave me an understanding of what the hell an argument is =]

  • @DarkHentaiDragon love the username. 

  • @kile392jr1 **System.out.println(you + " ARE FREAKING STUPID");

  • Exactly. Java is for 10 yrs old shits like cakefactoryy

  • Thumbs up if your here because of minecraft.

  • 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

  • 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 they're brackets not parenthisis. There is no actual difference, it's an array so it doesnt matter where you put []

  • Does it make difference if you put the [ ] after or before the args in String [ ] args ?

  • @COGSniper omg i love you! makes this so much easier!

    

  • u make me want tuna

  • type "syso" (no quotation marks, just syso), and press CTRL + Space. Your welcome.

  • i subbed

  • woman womanObject = new woman();

    Objectifying women :D

  • @xero907

    >> woman cannot be resolved to a type <<

    does not work :(

  • @BigTentacleEnt public class woman{

    public void clean(){

    System.out.println("BUY ME MORE JEWELERY!");

    }

    }

    ... :D

  • @xero907 You sir, made my day great!

  • @NorwayHack I'm glad to know that.

  • @xero907 you wish woman were so easy to :P

  • @xero907 you wish women were so easy to handle :P

  • @xero907 I hate myself for laughing at this xD

  • @Kjellemann2k You shouldn't :P

  • @xero907 shouldn't treat a woman as an object. Thats being a player.

  • there is no point to make tuna, you could just make it in the same class, it just makes it more organized

  • So great tuts man!

  • i dont understand

    tunaObject.simpleMessage(name)­;

    i dont understand why you need name in the parameters

  • @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.

  • 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); }

    }

  • Your bad ass!

  • thanks!

  • Instead of Scanner, can you use JOptionpane.showInputDialog();­ from javax.swing.* ?

  • This tutorial was pretty hard :o

    tho I'm ready for the next one :)

    ty

  • heheh

  • 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?!!?!?!?!?!?!?!?!?

  • Got it!

  • 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 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 :)

  • Friend: well vids is the most awesome way to learn

    Me: no

    Me: bucky is the best way

    Friend: bucky?

    Me: :OOO

  • System.out.println("Hello " + name + ". You're unbelievably ugly!");

  • @EpicnessPivotMaster You're trying to recreate GlaDOS? And in Java no less.

  • *eats his tuna sandwich while watching these tutorials* . no really though. im eating a tuna sandwich right now O_O

  • @nyczchimp1

    You can alternate between the two. It's just creating a string array called args.

  • 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!"); }

    }

  • Comment removed

  • Comment removed

  • this takes a loooong time. i wish java was easier than this... -_-

  • why is there a red line under my simplemessage and when i try and run it its an error?

  • @axelGunit in tuna class you write string not String

  • @JustDream257 that doesent help sorry

  • @axelGunit simplemessage(); Did you add the parameters?

  • I still don't get the diff between methods and classes

  • @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 but? Okay I get it now. Thanks! =)

  • @borsxo but thats the best way i can describe it ^^

    glad to be of use.

  • THIS IS AMAZING! I have been trying to understand classes for MONTHS now, and I FINALLY GET IT OMGOMGOMGOMGOMGOMGOMG!!!

  • Lol I name my class object the same name as the class so.

    Tuna Tuna = new Tuna (); haha. makes it simpler.

  • @nyczchimp1

    Both the statements are same!!!

    

  • 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!

  • 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 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 "+".

  • why in tuna tunaObject= new tuna(); it didn't show any correction or error message even if the tuna variable had been type twice?

  • 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  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.

  • @NoFatGamer

    tunaObject.simpleMessage(name + "!"); works :)

  • @NoFatGamer buddy, the best way is this:

    System.out.println("Hello " + name + "!");

  • can i declare String name under public void simpleMassage instead of declaring it in open and close parenthesis?

  • Does anyone else just keep the Scanner imported, from tut to tut?

  • @TzKet4m

    no, becous i think that messes with the code, if you import it and don't use it.

  • @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

  • @TzKet4m - "Yes, I do" - Gabe Newell.