[5868] in java-interest
Static variable assigment
daemon@ATHENA.MIT.EDU (Vitaly Promislov)
Fri Mar 1 08:35:09 1996
Date: Fri, 1 Mar 96 14:58:32 ???
From: vitaly@diogen.asc.rssi.ru (Vitaly Promislov)
To: java-interest@java.sun.com
Hello All
May be I am asking silly question but I bit suporised that very simply
peace of code cause troubles for me. I wrote applet
where I would like to assign integer:
class Connect extends Applet
{
private final static int DEFAULT_PORT=4321;
private int server_port=DEFAULT_PORT;
public static void main(String args[])
{
try
{
server_port = (int)Integer.parseInt(args[0]);
// <<<< Error is here (line 67) !!!!
}
catch(Exception e)
{
System.out.println("Defaulting to port " + DEFAULT_PORT);
}
new Connect();
.........ommited........
When I compiling this the java respond to me:
javac Gonnect.java
Connect.java:67: Can't make a static reference to nonstatic variable server_port in class GenericServer.
server_port = (int)Integer.parseInt(args[0]);
Could anybody to say what does it mean?
______________________________________________________________________
Vitaly Promislov
Astro Space Center, Russia e-mail: vitaly@diogen.asc.rssi.ru
fax: 095 333-23-78
Phone: 333-23-12
URL: http://diogen.asc.rssi.ru/Vitaly.html
----------------------------------------------------------------------
These are my opinions only, and do not reflect anything
about my employer, Astro Space Center of Russian Academy of Science.
------------------------------------------------------------------------
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com