Java Programming Tutorial – 15 – Use Methods with Parameters

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

36 responses to “Java Programming Tutorial – 15 – Use Methods with Parameters”

  1. ozer akdogan Avatar

    l spent 3 hours on other sources and did get nothing but with this and previos one I totally understand. You are legend mate

  2. Vicky Daiya Avatar

    If in apples class, I used string k instead of string name and then tunaObject.simpleMessage(k). It would work right?

  3. Muneeb Hassan Avatar

    What is the advantage of using arguments?

  4. Ashthepanda O-O Avatar

    would it be better to do import java.util.*; also you have the best video tutorials on java i know because they are short and covers everything in the specific topic

  5. Emmet Casey Avatar

    Couldn't you just do:

    public static void main (String args[]) {
    Scanner bucky = new Scanner (System.in)

    String name;

    system.out.println("Enter name here")
    name = bucky.nextLine();
    System.out.println("Hello" + name);

    }

  6. Ly Ralei Avatar

    facepalm . Seriously, when you taught us the previous video, I tried doing this without even watching because I think it is also same as function based from what I learned in C++ then when I clicked the next video, what I did is exactly this

  7. dopier12 Avatar

    I think for total beginners it should be pointed out that naming the second variable name is merely coincidental. It could have been called anything, as long as it's a String due to the parameter in the tuna class restricting it as such. So say: String myName = inputNextLine(); would have worked as well.

  8. AJay Gupta Avatar

    how to use variable from one class to main class?? Can anyone help please!!

  9. Allen Goo Avatar

    You're the best 🙂
    Subscribed!
    Thanks!

  10. conacal rubdur Avatar

    Thanks for helping me.

  11. Tarunbir Singh Avatar

    the only thing your tutorial lacks are practice questions for each tutorial. Hope you keep that in mind for future tutorials

  12. Vardaan Bajaj Avatar

    In this video, you have used "public static void main(String[] args)" unlike the "public static void main(String args[])" used in previous tutorials. Does it mean the same?

  13. joab sarong Avatar

    why it's so hard for me to understand 🙁 student here

  14. Daniel Matthews Avatar

    The only problem i see with this is that in the main method, you are going to have a lot of variable names that you cant reuse

  15. Jeremy Schantz Avatar

    I'm loving these tutorials,(you rock Bucky) but in this one I'm getting the message "resource leak 'input' is never closed" can anyone help me with that? Thanks.

  16. Manuel Gozzi Avatar

    This guy is magnificent. He actually teaches unlike 95% of teachers.

  17. Cameron Christensen Avatar

    I'm new to the programming thing and I can't type into the area where he writes "Bucky Roberts". Is there something that I need to do before I can type anything? Thanks for your help!

  18. HNK2015 Avatar

    Watching this video a second time really helped understand it better!

  19. Mayur Patel Avatar

    (String[] args) or (String args[])??????

  20. MadGamerCanada™ | LimitZz3D Avatar

    why did he start putting [] on string rather than arg?

    (String arg []) > (String[] args)??

  21. Vicky Mukherjee Avatar

    Thank you so much bucky……

  22. Zzzzzz... Avatar

    My first language was python. So when he says method, I just think of function in python. A method or function just hold a piece of code and the reason you would use them is so you do not have to type the same piece of code over and over again.

  23. Shashwat Singh Avatar

    Can anyone here help me a bit with my question? :
    What will happen if I don't put in the 'String name' inside the parameters of the the method SimpleMessage? Where exactly is that info used up?
    Please help me! I wud be really happy if it's Mr. Roberts himself! 😀

  24. James Avatar

    Can you also do it this way, or is this bad practice?
    import java.util.Scanner;
    public class Current {

    public static void main(String [ ]args){

    Scanner input = new Scanner(System.in);

    System.out.println("Enter your name here:");
    String name = input.nextLine();

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

  25. Vexatious Avatar

    import java.util.Scanner;

    public class helloworld {

    public static void main(String[] args) {

    Scanner name = new Scanner(System.in);
    String yourName;

    System.out.println("Please give yourself a name.");
    yourName = name.next();

    System.out.println("Welcome " + yourName + ", to the classroom");

    }
    }

    this is what i do

  26. Sakhr Nabil Avatar

    Why did I have to write two classes to input this simple information!!!
    Couldn't I just write an extra method to call up these details??

    I would be more than happy for a brief clarification…

  27. leroytheboss Avatar

    this video took me 3 tries of rewatching to grasp, dont give up guys

  28. Them Plays Avatar

    HELP ME !!!
    tuna tunaObject=new tuna();
    its not working

  29. Biswanath Shaw Avatar

    how to add more than one string in tuna class

  30. TheLimer12 Avatar

    Made my first login system with Name, surname, username and password. Btw great tutorials! Leaned more the past 2 hours then i did in 1 month. Keep up the good work!
    Code:

    import java.util.Scanner;

    public class Tuna {
    public void simpleMessage(){
    String name;
    String surname;
    String pass;
    String userlogin;
    String username;
    String passlogin;
    Scanner emil = new Scanner(System.in);
    System.out.println("Enter name: ");
    name = emil.nextLine();
    System.out.println("Enter surname: ");
    surname = emil.nextLine();
    System.out.println("Enter username: ");
    username = emil.nextLine();
    System.out.println("Enter pass: ");
    pass = emil.nextLine();

    System.out.println();

    // Login starts
    System.out.println("Enter username: ");
    userlogin = emil.nextLine();

    if (username.equals(userlogin)){
    System.out.print("Hello! ");
    System.out.print(name);
    System.out.print(" ");
    System.out.print(surname);
    System.out.println();
    }else{
    System.err.println("You have been blocked!");
    System.err.print(userlogin);
    System.err.println(" does not match with your current username.");
    System.exit(0);

    }
    System.out.println("Enter password: ");
    passlogin = emil.nextLine();

    if (pass.equals(passlogin)){
    System.out.print("Hello! ");
    System.out.print(name);
    System.out.print(" ");
    System.out.print(surname);
    System.out.println(". You have succesfully logged in to your account!");
    System.out.print(" Your username is: ");
    System.out.print(username);
    System.out.println(" And your password is: ");
    System.out.println(pass);

    }else{
    System.err.println("You have been blocked!");
    System.err.print(passlogin);
    System.err.println(" does not match with your current password.");
    }
    }

    }

  31. george T Avatar

    What is the difference between argument and parameter.

  32. Reza Esfandiari Avatar

    Is it String or Eshtring?

  33. AJD Avatar

    how is my tuna class running without any main method and doing the exact same stuff?
    and also my program is running without any tuna object declared..
    help needed to understand this!

  34. Amylee Lallion Avatar

    I keep getting that it don't have a main… what to do? btw am using netbeans java bundle

  35. Leonard Davis Avatar

    You've helped me understand this stuff a lot better than a lot of my college professors, thank you

Leave a Reply

Your email address will not be published. Required fields are marked *