I. Output of public class Test implements Runnable { public void run() { System.out.println( "running!" ); } public void start( int i ) { } public static void main( String[] args ) { Test t = new Test(); Thread th = new Thread( t ); t.start( 1 ); } } II. Output of public static void main(String[] args) { int[] arr = { 0, 1, 2, 3, 4 }; System.out.println( arr[arr[arr.length-1]] ); } III. System.out.println (“3 in binary Nos=” + “Integer.toBinaryString(3)”); IV. Will the following java code compile? if not why? if yes write the output. abstract class A { abstract void callme(); // concrete methods are still allowed in abstract classes void callmetoo() { System.out.println("This is a concrete method."); } } class B extends A { void callmetoo() { System.out.println("B's implementation of callme."); } } class AbstractDemo { public static void main(String args[]) { B b = new B(); b.callmetoo(); } } } V. Output of ArrayList al = new ArrayList(); al.add("D"); al.add("F"); al.add(1, "A2"); al.remove("F"); al.remove(2); System.out.println("Contents of al: " + al); VI. Output of class ArrayListToArray { public static void main(String args[]) { // Create an array list. ArrayList al = new ArrayList(); // Add elements to the array list. al.add(1); al.add(2); al.add(3); al.add(4); System.out.println("Contents of al: " + al); // Get the array. Integer ia[] = new Integer[al.size()]; ia = al.toArray(ia); int sum = 0; // Sum the array. for(int i : ia) sum += i; System.out.println("Sum is: " + sum); } } VII. Explain with programming examples the following Java exception types 1. ClassNotFoundException 2. IllegalAccessException 3. InstantiationException 4. InterrupedException 5. NoSuchMethodException

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
I. Output of public class Test implements Runnable { public void run() { System.out.println( "running!" ); } public void start( int i ) { } public static void main( String[] args ) { Test t = new Test(); Thread th = new Thread( t ); t.start( 1 ); } } II. Output of public static void main(String[] args) { int[] arr = { 0, 1, 2, 3, 4 }; System.out.println( arr[arr[arr.length-1]] ); } III. System.out.println (“3 in binary Nos=” + “Integer.toBinaryString(3)”); IV. Will the following java code compile? if not why? if yes write the output. abstract class A { abstract void callme(); // concrete methods are still allowed in abstract classes void callmetoo() { System.out.println("This is a concrete method."); } } class B extends A { void callmetoo() { System.out.println("B's implementation of callme."); } } class AbstractDemo { public static void main(String args[]) { B b = new B(); b.callmetoo(); } } } V. Output of ArrayList al = new ArrayList(); al.add("D"); al.add("F"); al.add(1, "A2"); al.remove("F"); al.remove(2); System.out.println("Contents of al: " + al); VI. Output of class ArrayListToArray { public static void main(String args[]) { // Create an array list. ArrayList al = new ArrayList(); // Add elements to the array list. al.add(1); al.add(2); al.add(3); al.add(4); System.out.println("Contents of al: " + al); // Get the array. Integer ia[] = new Integer[al.size()]; ia = al.toArray(ia); int sum = 0; // Sum the array. for(int i : ia) sum += i; System.out.println("Sum is: " + sum); } } VII. Explain with programming examples the following Java exception types 1. ClassNotFoundException 2. IllegalAccessException 3. InstantiationException 4. InterrupedException 5. NoSuchMethodException
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 9 steps

Blurred answer
Knowledge Booster
Avoiding deadlock
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education