File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes regarding doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "regarding doubt" Watch "regarding doubt" New topic
Author

regarding doubt

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
can u tell the difference betw'n static and final?
difference Betw'n jdk1.1,jdk1.2
/
Driver?,

Trusted applets and untrusted applets?
/

------------------
Azam Bukhari
Ranch Hand

Joined: Oct 03, 2000
Posts: 58
Difference b/w Static & Final:
A STATIC (method or variable) can be use even if no object of the class exists.
A FINAL (method/ variable) can be initialized only once that is the value passed to them or assigned to them respectively cannot be changed, A (method/ variable)is declared with the word final
when we are usually working with constants like the value of (PI=3.14)

Difference b/w JDK 1.1 & jdk 1.2:
I think the main difference b/w the above two is the availability of some library files, some functions...i mean in jdk 1.1 the flexibility is less as compared to jdk 1.2.

Since I did not went on the topic of Applets.. I could not cooment on that.....

P.S. if you recieve any further information regarding the above two details i had provided or if there is anything wrong I had said then ..., I will be very happy if you forward me the right stuff
Azam Bukhari
sazam@email.com


------------------

Don't wanna invent the wheel again!!
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
I'll give it a try...
a static variable or method is one that belongs to the whole class, rather than an object of that class.
For example, say you have
class Test
{
static int i=0;
}
and you make a few objects of that class. If one of the objects sets i=5, all objects see i as 5.
You can also call static methods (and variables) if you don't have any objects. For example, you can do
--------------------------------------------------------
public class Test
{
public static void main( String args[] )
{
int num = TestStatic.getNumber();
}
}
class TestStatic
{
public static int getNumber()
{
return 3;
}
}
--------------------------------------------------------
a variable declared as final cannot be changed once it is set, which you have to do when you declare it.*
so this code:
class TestFinal
{
private final int myNum=5;
public void changeNum()
{
myNum = 10;
}
}
would not compile.
declaring a method final means you cannot override that method.
Hope that helps with those points.
* you can actually set a final variable's value in the constructor now, but nowhere else.
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
Sorry, didn't mean to step on you there.
 
wood burning stoves
 
subject: regarding doubt
 
Similar Threads
servlets
Applets
servelets and applets
basic questions on packages, 'friendly
Applets