Question: Given: class Tree {} class Pine extends Tree {} class Oak extends Tree {} public class Forest {public static void main(String [] args) {Tree tree
Given: class Tree {} class Pine extends Tree {} class Oak extends Tree {} public class Forest {public static void main(String [] args) {Tree tree = new Pine (); if(tree instance of Pine) System.out.println ("Pine"); if(tree instance of Tree) System.out.println("Tree"); if(tree instance of Oak) System.out.println("Oak"); else System.out.println("Oops");}} Select all choices that will be printed: a) Pine b) Tree c) Forest d) Oops e) Nothing is printed What will be the output of the program? public class Foo {public static void main(String [] args) {try {return;} finally {System.out.println("Finally");}}} a) Finally b) Compilation Fails c) The code runs with no output d) An exception is thrown at runtime
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
