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

Java Programming Tutorial – 15 – Use Methods with Parameters
by
Tags:
Comments
36 responses to “Java Programming Tutorial – 15 – Use Methods with Parameters”
-
l spent 3 hours on other sources and did get nothing but with this and previos one I totally understand. You are legend mate
-
If in apples class, I used string k instead of string name and then tunaObject.simpleMessage(k). It would work right?
-
What is the advantage of using arguments?
-
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
-
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);}
-
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
-
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.
-
how to use variable from one class to main class?? Can anyone help please!!
-
You're the best 🙂
Subscribed!
Thanks! -
Thanks for helping me.
-
the only thing your tutorial lacks are practice questions for each tutorial. Hope you keep that in mind for future tutorials
-
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?
-
why it's so hard for me to understand 🙁 student here
-
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
-
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.
-
This guy is magnificent. He actually teaches unlike 95% of teachers.
-
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!
-
Watching this video a second time really helped understand it better!
-
(String[] args) or (String args[])??????
-
why did he start putting [] on string rather than arg?
(String arg [])
—> (String[] args)?? -
Thank you so much bucky……
-
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.
-
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! 😀 -
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();
}
} -
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
-
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…
-
this video took me 3 tries of rewatching to grasp, dont give up guys
-
brilliant!!
-
HELP ME !!!
tuna tunaObject=new tuna();
its not working -
how to add more than one string in tuna class
-
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.");
}
}}
-
What is the difference between argument and parameter.
-
Is it String or Eshtring?
-
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! -
I keep getting that it don't have a main… what to do? btw am using netbeans java bundle
-
You've helped me understand this stuff a lot better than a lot of my college professors, thank you
Leave a Reply