-4
package com.mycompany.sockettest;

/**
 *
 * @author 11ede
 */
import java.net.Socket;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import javax.swing.JOptionPane;
        


public class newClient {
    private static final String SERVER_IP = "127.0.0.1";
    private static final int SERVER_PORT = 9095;
    
    public static void main(String args[]) throws IOException {
        Socket socket = new Socket(SERVER_IP, SERVER_PORT);
        
        BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        
        String serverReponse = input.readLine();
        
        JOptionPane.showMessageDialog( parentComponent null, serverResponse);
        
        socket.close();
        System.exit(status 0);

    }
}

The bottom two lines have been underlined in netbeans i'm not sure whats going on. It says in the hint the variable 'status' is to blame on the last line and on the line just above the socket.close , it says the symbol cannot be found again. Also says a ';' is to be expected but there is already one.

andrewJames
  • 19,570
  • 8
  • 19
  • 51

1 Answers1

1

You didn't declare your variables. status, parentComponent, and serverResponse need to be declared first in order to be used. With the method you are using, parentComponent needs to be of type Component and serverResponce needs to be an Object. status just needs to be an int. You can't declare them in the methods themselves when you are calling them.