adplus-dvertising

Welcome to the java lang and java io MCQs Page

Dive deep into the fascinating world of java lang and java io with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of java lang and java io, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of java lang and java io, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through java lang and java io. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of java lang and java io. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

java lang and java io MCQs | Page 15 of 26

Q141.
What is the output of this program?
    class X
    {
        int a;
        double b;
    }
    class Y extends X 
    {
 int c;
    }
    class Output 
    {
        public static void main(String args[]) 
        {
            X a = new X();
            Y b = new Y();
            Class obj;
            obj = b.getClass();
            System.out.print(obj.getSuperclass());
        }
    }
Discuss
Answer: (c).class X
Q142.
What is the output of this program?
    class X 
    {
        int a;
        double b;
    }
    class Y extends X 
    {
 int c;
    }
    class Output 
    {
        public static void main(String args[]) 
        {
            X a = new X();
            Y b = new Y();
            Class obj;
            obj = b.getClass();
            System.out.print(obj.isLocalClass());
        }
    }
Discuss
Answer: (d).false
Q143.
Which of the interface contains all the methods used for handling thread related operations in Java?
Discuss
Answer: (a).Runnable interface
Q144.
Which of these class is used to make a thread?
Discuss
Answer: (c).Thread
Q145.
Which of this interface is implemented by Thread class?
Discuss
Answer: (a).Runnable
Q146.
Which of these methods of a Thread class is used to suspend a thread for a period of time?
Discuss
Answer: (a).sleep()
Q147.
What is the output of this program?
    class newthread implements Runnable 
    {
 Thread t1,t2;
        newthread() 
        {
            t1 = new Thread(this,"Thread_1");
            t2 = new Thread(this,"Thread_2");
            t1.start();
            t2.start();
 }
 public void run() 
        {
            t2.setPriority(Thread.MAX_PRIORITY); 
     System.out.print(t1.equals(t2));
        }    
    }
    class multithreaded_programing 
    {
        public static void main(String args[]) 
        {
            new newthread();        
        }
    }
Discuss
Answer: (d).falsefalse
Q148.
What is the output of this program?
    class newthread implements Runnable 
    {
 Thread t;
        newthread() 
        {
            t = new Thread(this,"New Thread");
            t.start();
 }
 public void run()
        {
            t.setPriority(Thread.MAX_PRIORITY); 
            System.out.println(t);
 }
    }
    class multithreaded_programing 
    {
        public static void main(String args[]) 
        {
            new newthread();        
        }
    }
Discuss
Answer: (d).Thread[New Thread,10,main].
Q149.
Which object Java application uses to create a new process?
Discuss
Answer: (c).ProcessBuilder
Discuss
Answer: (b).Java system properties are accessible by processes they are added to

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!