Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 18:34 Go to next message
Debbie Davis is currently offline Debbie DavisFriend
Messages: 1
Registered: January 2022
Junior Member
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 23:11 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

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.


_
Nitin Dahyabhai
Eclipse Web Tools Platform
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: Tue Apr 23 08:48:36 GMT 2024

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

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

Back to the top