FIXED, thanks for your help guys =]
Type: Posts; User: R0bsterz
FIXED, thanks for your help guys =]
i know what a variable is
i don't fully know how to assign a value to a variable
i dont know how to call a method
i dont know how to assign the value that the method returns to a variable...
I really dont understand this...
Can someone just edit my code and leave comments on each line? (Im a **** noob at java)
And someMethod(); is? (what shall i enter for it?)
I dont know how to save the user input in step 1
2. Im not sure, can u tell me>?
This is what i want the program to do
1. Wait for the user input from the scanner/JOptionPane Dialogue Box
2. If the user input is the word "Sammy" then say "Hello Sammy"
3. If the user input is...
1. Well ideally, i would like to import the JOptionPane from javax.swing.JOptionPane and let the user import it from there
2. Im not sure, u can tell me what/how to do this...
No, It does not give me a box to enter the data..
--- Update ---
This is what i want the program to do:
1. Wait for the user input from the scanner
2. If the user input is the word "Sammy"...
I compile the code and my cursor says its loading... then nothing happens. (I compile + run with eclipse.)
So this is what i want my code to do:
http://i45.tinypic.com/674ec4.png
My code at the moment:
import java.util.Scanner;
class ifelse {
public static void main (String args[]) {
Scanner uinput = new Scanner (System.in);
String uinputvar =...
How do i make a new string that takes the value of the scanner "guest" and then use it with the .equals method?
1. When i ran the code in post #20 it didnt run properly -- looks like i didnt close the scanner or somthing.
2. i didnt understand post #21
3. if (name.equals(name)) {
was meant to mean: if...
Fix this code instead:
import java.util.Scanner;
class ifelse {
public static void main (String args []) {
String name = "Sammy";
Scanner guest = new Scanner (System.in);
This is my code at the moment. Sorry Norm, but I do not understand what you are saying when you are trying to help me :P, please edit my code and 'fix it' and add comments on each line so i can learn...
Sorry but i really dont understand you..
Please add what your saying to my code and i will be eternally grateful.
import java.util.Scanner;
class ifelse {
public static void main (String args []) {
String name = "Sammy";
Scanner guest = new Scanner (System.in);
System.out.println("Hello, What...
Ok, so i edited the code a bit and it now looks like this:
import java.util.Scanner;
class ifelse {
public static void main (String args []) {
String name = "Sammy";
Scanner...
Sorry, but i dont understand what you mean by a seperate one input by the user, please could you add the code to my code and show me,
Thanks =]
I read your post but how will i create a new variable for the input?
Thanks for this, so to close the scanner i do
scanner1.close();
--- Update ---
import java.util.Scanner;
Thanks for this, however i tried entering my new code:
import java.util.Scanner;
class ifelse {
public static void main (String args []) {
String name = "Sammy";
Scanner scanner1...
class ifelse {
public static void main (String args []) {
String name = "Sammy";
if (name == "Sammy"); {
System.out.println("Hello "+ name);
}else{
System.out.println("Sorry...