Here is The code from the book of K&B Can Any one please tell me how we use the private methods??? how the private methods of Dog Class involbs??? :roll:
(shouts not necessary in topic title) [ February 26, 2007: Message edited by: Barry Gaunt ]
class Dog implements Serializable { transient private Collar theCollar; public int dogSize; public Dog(Collar collar, int size) { theCollar = collar; dogSize = size; }
I appreciate you for imposing the Why. I too don't know what happens exactly there. Here is a hint that can happen. Hope it will improve your thought process...
interface Catch{
private void display(); public void callDisplay();
}
class Try{
private void display() { System.out.pritntln("I like the way you thinking"); }
The method is invoked by the JVM. JVM can access your private methods. But other classes would not be able to access the same. Serializable is a marker interface having no methods. There are many methods you can have in your class which implements serializable to tell the JVM what to do at runtime with the method. A look at the api would be good. Here you go.