Given Fruit orange new Fruit orangesmell When you run it it
Given: Fruit orange = new Fruit();
orange.smell();
When you run it, it should be:
A. No smell
B. Compiles ok. Fails at runtime
C. I smell good
D. I smell yummy
E. Fail to compile
Solution
 public class fruit{
    public void smell(){
        System.out.println(\"NO smell\");
    }
 }
 import java.util.*;
 public class lab0604{
    public static void main(String args[]){
    fruit orange=new fruit();
    orange.smell();
 }
 }
 output:NO smell
 1.import java.util.*;
 public class lab0604{
    public static void main(String args[]){
    fruit orange=new fruit();
    orange.smell();
 }
 }
 class fruit {
 public void smell(){
 System.out.println(\"I smell good\");
 }
 }
 output:I smell good
here i implemented the class fruit with method smell and in method main i create a fruit object and i executed the smell method.
 4.if we doent create a fruit class and we create an object it shows compilation error.

