Can someone help me to get this code to run. What am I missing. Any help is greatly appreciated.

import java.io.*;
public class Quiz
{
 public static void main(String args[]) 
 {
    int correctCounter;
InputStreamReader reader;
BufferedReader buffer; keyboard = new
    BufferedReader (new InputStreamReader (System.in));
 }
String seekResponse;
    System.out.println("Welcome to Hoffman School .. ");
    {
      // choose the subject
     System.out.println("enter h for humanities, e for English or x for exit");
             seekResponse = keyboard.readline();
    if (seekResponse.equals ("h"); //do humanities quiz
    {   System.out.println("The Declaration of Independence is the same as the   
            constitution");
        seekResponse = keyboard.readline();
        if (seekResponse=("t"));
        System.out.println("incorrect answer");
        if (seekResponse.equals ("f"));
        System.out.println("correct");
System.out.println("At the Boston Tea Party the people threw coffee overboard");
if (seekResponse.equals ("t"));
System.out.println("incorrect answer");
If (seekResponse.equals ("f"));
System.out.println("correct");
    }
    else if (seekResponse.equals ("e"); //do English quiz

{System.out.println("A period goes at the end of a question");
        seekResponse = keyboard.readline();
        if (seekResponse.equals ("t"));
        System.out.println("incorrect answerz");
        if (seekResponse.equals ("f"));
        System.out.println("correct");
System.out.println("Most sentences begin with a capital letter");
if (seekResponse.equals ("t"));
System.out.println("incorrect answer");
If (seekResponse.equals ("f"));
System.out.println("correct");
    }
    else if (seekResponse.equals ("x")); 
        exit// do exit logic
    }
}

Here's the modified code

import java.io.*;
public class Quiz
{
	public static void main(String args[]) 
	{
		int correctCounter;
		InputStreamReader reader;
		BufferedReader buffer; 
		keyboard = new BufferedReader (new InputStreamReader (System.in));
	}

	String seekResponse;
	System.out.println("Welcome to Hoffman School .. ")
	{
		// choose the subject
		System.out.println("enter h for humanities, e for English or x for exit");
		seekResponse = keyboard.readline();
		if (seekResponse.equals ("h") //do humanities quiz
		{ 
			System.out.println("The Declaration of Independence is the same as the constitution");
			seekResponse = keyboard.readline();
			if (seekResponse=("t"))
				System.out.println("incorrect answer");
			if (seekResponse.equals ("f"))
				System.out.println("correct");
				System.out.println("At the Boston Tea Party the people threw coffee overboard");
			if (seekResponse.equals ("t"))
				System.out.println("incorrect answer");
			If (seekResponse.equals ("f"))
				System.out.println("correct");
		}
		else if (seekResponse.equals ("e") //do English quiz
		{
			System.out.println("A period goes at the end of a question");
			seekResponse = keyboard.readline();
			if (seekResponse.equals ("t"))
				System.out.println("incorrect answerz");
			if (seekResponse.equals ("f"))
			{
				System.out.println("correct");
				System.out.println("Most sentences begin with a capital letter");
			}
			if (seekResponse.equals ("t"))
				System.out.println("incorrect answer");
			If (seekResponse.equals ("f"))
				System.out.println("correct");
		}
		else if (seekResponse.equals ("x")) 
			exit// do exit logic
		}
	}
}

You shouldn't put a ; at the end of EVERY line. like:

if(1 > 2); // <-- that ; shouldn't be there

The other problem is that if you have more than one statment after an if, you need a curly bracket like this:

if(10 < 200)
    System.out.println("this is ok to do");
// That was ok

if(10 < 200){
    System.out.println("First Line");
    System.out.println("Second Line");
}

If you leave out the curly braces on that second example you will always print the second line, which wouldn't be the desired result.

Lastly, you had a capital I in an if statment. That won't work. Java is case sensitive.
Hope that helped.

Thanks so much for your help. All I have to do now is add the counter to this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.