Small Conversation

Posts 15 of 5 · Page 1 of 1
Small Conversation
I am learning Java, and just to have some fun (it was really easy, im already alot more advanced in Java) I created this small conversation bot:

Code:
/*
 * Author = Pedro(pxpc2). 
 */

package smallProjects;

import java.util.Scanner; // Importing the pre-made class Scanner from JAVA API

public class Conversation 
{ // Start of the class

	public static void main(String args[])
	{ // Start of the main method
		
		// Creating objects:
		Scanner input = new Scanner(System.in);
	
		
		// Asking the user:
		System.out.println("Before we start, what's your name?");
		String name = input.nextLine();
		System.out.printf("Hello mister %s. How are you?\n", name);
		String howIs = input.nextLine();
		System.out.printf("So you are %s? Okay, well, how old are you?", howIs);
		int age = input.nextInt();
		System.out.printf("So you are %d? Great! Do you play a game?", age);
		String game = input.nextLine();
		System.out.printf("So you play %s? Nice..\n", game);
		if (game == "Runescape")
		{
			System.out.println("I know this game!");
		}
		System.out.println("Do you know programming?");
		String know = input.nextLine();
		if (know == "yes")
		{
			System.out.println("Let's talk sometime :D");
		}
		System.out.println("Oh man! My mother is coming! I have to go! Bye!");
		
		// Methods:
	
		
	} // End of the main method
	
	
} // End of the class
Good for learning
Good job I guess. Ugly code though :P
it looks interesting :P
good luck making more
Posts 15 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?