|
 |
pro_java_server thread: doubt in java
Message #1 by "kishore" <dvrskishore@y...> on Wed, 21 Feb 2001 06:46:38 +0530
|
|
Hi there
You create a class and include a main for an application. Check on your
code. It should state as
public class a
{
public static void main(String args[])
{
// Do something
}
}
-----Original Message-----
From: sandeep garg [mailto:sandeepgarg_2000@y...]
Sent: Thursday, February 22, 2001 10:06 AM
To: Java Server
Subject: Re: doubt in java
--- Manas Ranade <manasranade@y...> wrote:
> Hi All,
> I tried running this on my pc, no class gets
> created. It only cribs about either a class or
> interface should be there. I'm using SUNs jdk1.3.
>
> Manas.
>
> --- Jeljo Kottoor <jeljokottoor@h...> wrote:
> > hi..,
> > it is quite surpri
well this sing the compiled class is
> created
> > even though it is
> > showing the compilation error. The error is =E2EUR~coz
> > you have not given the
> > key word =E2EUR~class=E2EUR(tm) between public & class name.
> I
> > think, by default the
> > compiler assumes it as a class & that will be the
> > reason the compiled class
> > is formed. And as the compiled classis there, when
> u
> > run it- you get the
> > output.
> >
> >
> > >From: "kishore" <dvrskishore@y...>
> > >Reply-To: "Java Server"
> > <pro_java_server@p...>
> > >To: "Java Server" <pro_java_server@p...>
> > >Subject: doubt in java
> > >Date: Wed, 21 Feb 2001 06:46:38 +0530
> > >
> > >hi friends,
> > > here is a doubt in Java.
> > >consider the eg:
> > >
> > > public a{
> > > public static void main(String[] a)
> > > {
> > > System.out.println("Hello!!");
> > > }
> > > }
> > >
> > >if compiled and run then eventhough it gives an
> > error
> > >like:
> > >
> > >"class or interface expected"
> > >
> > >still it creates the class file and gives the o/p
> > >Hello
> > >can u send in ur views regarding this.........
> > >
> > >looking forward 2 ur precious reply
]
well this is very simple ... this is because of the
key word static . what actually happens is that when
the runtime environment execute this block it first
calls and run the static functions or give space to
static variables.
this is why you get this output even though this is an
incomplet java programme....
sandeep
from india sandeepgarg_2000@y...
|
|
 |