Skip to main content



      Home
Home » Newcomers » Newcomers » "cin cannot be resolved"(Error message "cin cannot be resolved" in Eclipse for Java program.)
"cin cannot be resolved" [message #1849231] Sun, 09 January 2022 13:34 Go to next message
Eclipse UserFriend
I am a beginner in learning java. The following simple program gives me several error messages of "cin cannot be resolved"

package testingProject;
public class MainClass {
public static void main(String[] args) {
// TODO Auto-generated method stub

double angle1, angle2, angle3;
System.out.print("Enter 1st angle: ");
angle1 = Double.parseDouble(cin.nextLine());
System.out.print("Enter 1st angle: ");
angle2 = Double.parseDouble(cin.nextLine());
System.out.print("Enter 2nd angle: ");
angle3 = 180 - angle - angle2;
System.out.println(angle3);
}

}

Error messages:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
cin cannot be resolved
cin cannot be resolved
angle cannot be resolved to a variable

at testingProject.MainClass.main(MainClass.java:10)
What should I do to fix it?
Re: "cin cannot be resolved" [message #1849234 is a reply to message #1849231] Sun, 09 January 2022 18:11 Go to previous message
Eclipse UserFriend
This isn't really a Java programming forum. You might want to ask in https://coderanch.com/f/33/java . That said, you should
have been getting error messages in the Java Editor indicating that cin and angle can't be resolved,--you have not
declared either of them as local variables.
Previous Topic:Java Eclipse doesn't show any error (the red bulb) but the code still can't run
Next Topic:Eclipse JAVA IDE crashing
Goto Forum:
  


Current Time: Fri Jul 18 04:29:02 EDT 2025

Powered by FUDForum. Page generated in 0.12443 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top