Tag: technology
Questions Related to technology
Given: 1. public class Plant { 2. private String name; 3. public Plant(String name) { this.name = name; } 4. public String getName() { return name; } 5. } 1. public class Tree extends Plant { 2. public void growFruit() { } 3. public void dropLeaves() { } 4. } Which statement is true?
Given: 1. public class Threads2 implements Runnable { 2. 3. public void run() { 4. System.out.println("run."); 5. throw new RuntimeException("Problem"); 6. } 7. public static void main(String[] args) { 8. Thread t = new Thread(new Threads2()); 9. t.start(); 10. System.out.println("End of method."); 11. } 12. } Which two can be results? (Choose two.)
Given: 1. public class TestSeven extends Thread { 2. private static int x; 3. public synchronized void doThings() { 4. int current = x; 5. current++; 6. x = current; 7. } 8. public void run() { 9. doThings(); 10. } 11.} Which statement is true?