Computer Science, asked by Parvani7608, 1 year ago

What will be the output of the program? class tree { } class pine extends tree { } class oak extends tree { } public class forest1 { public static void main (string [] args) { tree tree = new pine(); if( tree instanceof pine ) system.out.println ("pine"); else if( tree instanceof tree ) system.out.println ("tree"); else if( tree instanceof oak ) system.out.println ( "oak" ); else system.out.println ("oops "); } }

a. pine

b. tree

c. forest

d. oops?

Answers

Answered by Michealsingh
0
ans is d.oops
hope that it will clear your doubts
hope that it will clear your doubt
Answered by honeychowdary2000
0

Answer:

answer is pine(option a)

Explanation:

As the object passed to ref value of tree is pine.

Similar questions