Question:
Exception in thread "main" java.lang.Error: Unresolved compilation problem?
Jarrod Herbert
2012-03-03 16:20:05 UTC
I am getting this error in Java Eclipse :

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at Cliff.main(Cliff.java:7)


The following is my coding -

import java.util.Scanner;

public class Cliff {
/**
* @param args
*/
public static void main(String[] args) {

String choice;

Scanner user_in = new Scanner(System.in);

System.out.println("Welcome to the Cliff. Ahead, there is a cliff you can jump off of. Behind you, there is a charging axeman. You have a bow. What do you do?");

choice = user_in.nextLine();

if(choice.equals("Shoot the axeman")){

System.out.println("Your bow string broke and you're cut to peices.");

}else if(choice.equals("Jump off cliff")){

}System.out.println("Wise choice. Less of a mess.");

}else{

System.out.println("You were killed by the axeman due to lack of a proper choice.");


// TODO Auto-generated method stub

}

}
Four answers:
Kenneth
2012-03-03 16:32:33 UTC
You matched the brackets up incorrectly in you if/else statements, try this: http://ideone.com/uRzmH

________________________________________________________________________________

import java.util.Scanner;



public class Cliff {

/**

* @param args

*/

public static void main(String[] args) {



String choice;



Scanner user_in = new Scanner(System.in);



System.out.println("Welcome to the Cliff. Ahead, there is a cliff you can jump off of. Behind you, there is a charging axeman. You have a bow. What do you do?");



choice = user_in.nextLine();



if(choice.equals("Shoot the axeman")){



System.out.println("Your bow string broke and you're cut to peices.");



}else if(choice.equals("Jump off cliff")){



System.out.println("Wise choice. Less of a mess.");



}else{



System.out.println("You were killed by the axeman due to lack of a proper choice.");



}

// TODO Auto-generated method stub



}



}
James Bond
2012-03-03 16:46:33 UTC
Just brackets problem

import java.util.Scanner;



public class Cliff {

/**

* @param args

*/

public static void main(String[] args) {



String choice;



Scanner user_in = new Scanner(System.in);



System.out.println("Welcome to the Cliff. Ahead, there is a cliff you can jump off of. Behind you, there is a charging axeman. You have a bow. What do you do?");



choice = user_in.nextLine();



if(choice.equals("Shoot the axeman")){



System.out.println("Your bow string broke and you're cut to peices.");



}

else if(choice.equals("Jump off cliff")){



System.out.println("Wise choice. Less of a mess.");



}

else{



System.out.println("You were killed by the axeman due to lack of a proper choice.");





// TODO Auto-generated method stub



}



}

}
rita
2016-06-20 12:51:21 UTC
Unresolved Compilation Problem
stutsman
2016-09-10 13:16:29 UTC
Thought is a belief within the type of electro-chemical reactions which provide the philosopher the sensation of life and fact. HAHAHAHAHAHAHA!!! Just a proposal............ :)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...