cannot resolve symbol
“cannot resolve symbol” means that the Java compiler cannot locate a symbol referenced in your Java source code.
The causes for this common error include:
- A missing class file
- A faulty CLASSPATH
- A symbol name is mispelled or miscapitalized
- A data type is incorrect, misspelled, or miscapitalized
- A method is called with the wrong number or types of arguments
- An undeclared variable
cannot resolve symbol errors can be very difficult to track down. Code carefully!
Comments (1)
Leave a Reply
- Java Class
A Java class is a group of Java methods and variables. Each Java source code file can contain one public class. The name of this public class must match the name of the Java source code file. If the public class is called “ballistics,” then the filename would be “ballistics.java.” Example Java Class class Ammunition [...]...
- Java Method
A Java method is a set of Java statements that can be included inside a Java class. Java methods are similar to functions or procedures in other programming languages. There are many different types of Java methods: Final Method Public Method Private Method Package Method Instance Method Protected Method Static Method Main Method The Main [...]...
- Java Source Code
Java source code is code that you write in the Java programming language. Java source code is converted to Java bytecode by the Java compiler. Java source code files usually have the .java extension. Sun recommends that Java source code files be no longer than two thousand lines. Larger source code files should be split [...]...
- Constructor
A constructor is a special method for initializing a new instance of a class. The constructor method for a class will have the same name as the class. Constructor Example This example shows a class and a constructor named Circle: public class Circle { public int x = 0; public int y = 0; public [...]...
- Java Loops – For, While, and Do
Java supports three types of loops: For, While, and Do. The Java For Loop The Java for loop is a looping construct which continually executes a block of statements over range of values. Java for Loop Syntax The syntax of a for loop in Java is: for (initialization; termination; increment) { statement } Example Java [...]...






i have written a tcpclient program when compiling it shows error as “cannot resolve symbol”the program is
import java.net.*;
import java.io.*;
public class GreetingClient
{
public static void main(String args[])
{
String serverName = args[0];
int port = Integer.parseInt(args[1]);
try
{
System.out.println(“Connecting to ” + serverName
+ ” on port ” + port);
Socket client = new Socket(serverName, port);
System.out.println(“Just connected to “+ client.getRemoteSocketAddress());
OutputStream outToServer = client.getOutputStream();
DataOutputStream out =new DataOutputStream(outToServer);
out.writeUTF(“Hello from “+ client.getLocalSocketAddress());
InputStream inFromServer = client.getInputStream();
DataInputStream in =new DataInputStream(inFromServer);
System.out.println(“Server says ” + in.readUTF());
client.close();
}catch(IOException e)
{
e.printStackTrace();
}
}
}