71.
What is the length of the application box made in the following Java program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
    Graphic g;
    g.drawString("A Simple Applet",20,20);    
}

72.
What will be the output of the following Java program?
import java.io.*;
public class filesinputoutput 
{
  public static void main(String[] args) 
    {
 String obj  = "abc";
       byte b[] = obj.getBytes();
       ByteArrayInputStream obj1 = new ByteArrayInputStream(b);
       for (int i = 0; i < 2; ++ i) 
       {
           int c;
           while ((c = obj1.read()) != -1) 
           {
             if(i == 0) 
               {
                 System.out.print((char)c); 
             }
           }
       }
    }
}

77.
What happens when we access the same variable defined in two interfaces implemented by the same class?

80.
What will be the output of the following Java program?
import java.io.*;
class Chararrayinput 
{
    public static void main(String[] args) 
    {
  String obj  = "abcdefgh";
        int length = obj.length();
        char c[] = new char[length];
        obj.getChars(0, length, c, 0);
        CharArrayReader input1 = new CharArrayReader(c);
        CharArrayReader input2 = new CharArrayReader(c, 1, 4);
        int i;
        int j;
        try 
        {
while ((i = input1.read()) == (j = input2.read())) 
            {
                System.out.print((char)i);
            }
        } 
        catch (IOException e) 
        {
      // TODO Auto-generated catch block
            e.printStackTrace();
  }
}
}

Read More Section(Interfaces and Abstract Classes)

Each Section contains maximum 100 MCQs question on Interfaces and Abstract Classes. To get more questions visit other sections.