“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!
RekhaNaganathan
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();
}
}
}