General Java Questions II
It is the same as ==, if it isn t overriden by the object class.
Many classes override the method equals (). In this case this method will check that
content of the object is the same or not, not addresses.
 Q: Why do I get message like  wrong magic number  when I am trying to run
applet? What is magic number?
Answer: The first thing a JVM does when it loads a class is check that the first four
bytes are (in hex) CA FE BA BE. This is the "magic number" and thats why you are
getting that error, you are trying to load a file that isnt a class and so the class loader
in the JVM is throwing out that exception.
Make sure you transfer the class files to site in binary mode, rather than text or ASCII
mode. 
An error from the browser saying "cannot start applet ... bad magic number" usually
means that one of the class files on the server is corrupted.  
Replace your class binary files on the web server; clean up the cache of your
browser, and reload your applet.
Q: In java, I found a lot of methods, which let you enter a line (read (), readLine ()
e.c.t). They all wait until return is pressed, and then start providing you the
information.
Does anyone know if there is a read method available whit the desired behaviour, i.e.
which doesn t wait for return being pressed?
Answer: Java does not provide it, the terminal itself waits until return is pressed
before sending the entered line to Java.
You need to use some platform specific mechanism to change the terminal settings.
Q: Can I pass a function as a parameter in Java? If so, how?
Answer: No, you cannot. But you can pass an object with method and then just use
this method like this:
myFunction (object); // object has method useMyMethod(){ do smth here...}
..
..
somewhere in another place where use this function..
object.useMyMethod();
What is difference capacity() and size() methods for vector?
 What is difference between 
public final int capacity()
Returns the current capacity of this vector.
and 
public final int size()
Returns the number of components in this vector.
Answer: please read this method: ensureCapacity
public final synchronized void ensureCapacity(int minCapacity)
file:///F|/a_jsite/350_tips/general_java II.htm (9 of 14) [2001 07 08 11:24:53]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved