Simple yes/no function...
I'm new to Java, I'm writing a simple application to convert celcius into farenheit just to teach myself some things.
So far I've written this (to generally get some information from the user):
In the yes/no function part I want to write a code which does the following: when the user presses 'Y', the code continues, when the user presses 'N' the code goes back to the first line.
public class Code
public static void main(String args)
Scanner scan = new Scanner(System.in);
String string1, string2, yes, no;
string1 = scan.nextLine();
string2 = scan.nextLine();
System.out.println("Name: " + string1 + " " + string2 + "," + " is this correct?");
After this I'll write the rest of the code which converts celcius into farenheight, this I can do.
Re: Simple yes/no function...
In future, please use highlight tags around your code (see my signature)
Is there a question here?
I suggest you read:
The if-then and if-then-else Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)