Post: (Java) Basic 3 Question Quiz
11-27-2011, 08:47 AM #1
Pichu
RIP PICHU.
(adsbygoogle = window.adsbygoogle || []).push({}); So essentially I'm breaking away from C# for a while and am going to learn the work of Java. I've looked a couple of videos that gave me a simplified understanding of the layout and so I've used some of my knowledge from C# and applied it to Java.

I got to video 7 on TheNewBoston and decided to test what I know already and the little crap I learned for console-like use from him.

Very simple, took me about 10 minutes to write (I got a dumb looping error and it took a couple of minutes to figure out why lol).

It's fixed, Smile

    import java.util.Scanner;

public class BasicQuiz {

public static void main(String[] args) {
int Correct = 0;
String a, b, c;
a = "Sublimity"; b = "Outsider"; c = "8";
while (Correct == 0){
System.out.println("What is my name? (Case Sensitive)");
Scanner input1 = new Scanner(System.in);
String answer1 = input1.nextLine();
if (answer1.equals(a)){
System.out.println("Congrats");
Correct++;
}
else{
System.out.println("Wrong, please try again");
}
}
while (Correct == 1){
System.out.println("Who created this forum? (Case Sensitive)");
Scanner input2 = new Scanner(System.in);
String answer2 = input2.nextLine();
if (answer2.equals(b)){
System.out.println("Congrats");
Correct++;
}
else{
System.out.println("Wrong, please try again");
}
while (Correct == 2){
System.out.println("What is 4 + 4?");
Scanner input3 = new Scanner(System.in);
String answer3 = input3.nextLine();
if (answer3.equals(c)){
System.out.println("Congrats you have finished");
System.out.close();
}
else{
System.out.println("Wrong, please try again");
}
}
}
}
}




Simplified to my liking. Just felt like sharing, even though it really isn't anything special.

***Goal = Learn to make applications, basic games, and maybe use my knowledge to create Minecraft mods***
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked Pichu for this useful post:

Docko412
11-28-2011, 12:17 AM #2
Originally posted by Sublimity View Post
So essentially I'm breaking away from C# for a while and am going to learn the work of Java. I've looked a couple of videos that gave me a simplified understanding of the layout and so I've used some of my knowledge from C# and applied it to Java.

I got to video 7 on TheNewBoston and decided to test what I know already and the little crap I learned for console-like use from him.

Very simple, took me about 10 minutes to write (I got a dumb looping error and it took a couple of minutes to figure out why lol).

It's fixed, Smile

    import java.util.Scanner;

public class BasicQuiz {

public static void main(String[] args) {
int Correct = 0;
String a, b, c;
a = "Sublimity"; b = "Outsider"; c = "8";
while (Correct == 0){
System.out.println("What is my name? (Case Sensitive)");
Scanner input1 = new Scanner(System.in);
String answer1 = input1.nextLine();
if (answer1.equals(a)){
System.out.println("Congrats");
Correct++;
}
else{
System.out.println("Wrong, please try again");
}
}
while (Correct == 1){
System.out.println("Who created this forum? (Case Sensitive)");
Scanner input2 = new Scanner(System.in);
String answer2 = input2.nextLine();
if (answer2.equals(b)){
System.out.println("Congrats");
Correct++;
}
else{
System.out.println("Wrong, please try again");
}
while (Correct == 2){
System.out.println("What is 4 + 4?");
Scanner input3 = new Scanner(System.in);
String answer3 = input3.nextLine();
if (answer3.equals(c)){
System.out.println("Congrats you have finished");
System.out.close();
}
else{
System.out.println("Wrong, please try again");
}
}
}
}
}




Simplified to my liking. Just felt like sharing, even though it really isn't anything special.

***Goal = Learn to make applications, basic games, and maybe use my knowledge to create Minecraft mods***


not bad java is a great language in enjoy it from time to time.
11-28-2011, 01:02 AM #3
Pichu
RIP PICHU.
Originally posted by Docko412 View Post
not bad java is a great language in enjoy it from time to time.


Yea, I've gotten about 1-1/2 hours into the learning of it and so far I'm finding it like a duplicate of C# expect the names of methods. Aha, I think because right now my computer isn't that great, I could learn Java and create simple basic games to play on then when I get a better computer I'll move back to C# learn XNA and use both Java and C# in developing simple game projects of mine that I want to do. Smile

Use one for launching and the other for the actual game source.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo