Latest Answer: The answer given is absolutely right along with that we also say the following1. Static variable has only one copy for all the methods in class while instance variable has many copy.2. Class can access only static variable while object can access both class and instance variable. ...
Latest Answer: Dictionary Class ...
Latest Answer: this method is used to tracing the instance in your application. Which instance is running of the class. ...
Which is the most convient way to create a thread and Why?1) Extends from thread or2) Implements from Runnable Interface.
Latest Answer: Assertions are kind of mechanisms in java from 1.4 onwards, where assert is a keyword. By using assertions you can validate your assumptions. Assertions should be only used to validate certain assumptions. Assertions should:1. Be used to assertain the ...
The following code defines the ThreadSample class. public class ThreadSample implements Runnable { public static void main(String args[]) { System.out.println("This is the ThreadSample object"); } public void run() { while (true) { try { Thread.sleep(100); System.out.println("Thread ran."); } catch (Exception e) {} } } } Referring to the sample code above, how do you start an instance of ThreadSample in a new thread?
Class Animal { void speak() { System.out.println("speak"); } } class Dog extends Animal { void speak() { System.out.println("woof!"); } } class Cat extends Animal { void speak() { System.out.println("meow!"); } } public class AnimalTest { public static void main(String[] args) { Animal[] animals = new Animal[3]; animals[0] = new Animal(); animals[1] = new Cat(); animals[2] = new Dog(); for (int i=0; i < animals.length; i++) animals[i].speak();
Latest Answer: //declareprivate JTabbedPane pane ; //initialisepane = new JTabbedPane(); //add GUI components to the TABPANEpane.addTab(nameoftab, component); ...
Latest Answer: Telivison is a class Onida TV is an object ...
Latest Answer: We use synchronized methods or synchronised blocks to make your application thread safe. You can use synchronized methods, but the problems may be:1. It degrades the performance of your application.2. Slows down the your program because synchronozation ...
View page << Previous 1 2 3 [4] 5 6 7 8 9 10 Next >>

Go Top