Hey i am a beginner in programming. My code looks like this:

public ChatClient1(String screenName, String hostName) {


    String host=(args.length<1)?null:args[0];

...and it continues.

The error I am getting when i compile is:

cannot find symbol
symbol: variable args

and its for both the args in the code above.


That's because nowhere in that code do you define args.
Do you have a main method with args as its parameter? That version of artgs is only available inside main. You'll need to copy them to somewhere else to use them in other methods.

yea ive got a main program. it looks like this:

public static void main(String[] args)   {
          ChatClient client = new ChatClient(args[0],args[1]);

It looks like you are mixing up where to do error checking. To fix this you should move
String host=(args.length<1)?null:args[0];
into main before you create your new ChatClient, and then pass host into the constructor instead of args[0]. But you also need to be careful about the order of your arguments because the constructor lists screenName first and hostName second.

Hey! Thanks for the reply. It helped. :)