Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully solved examples with detailed. 5) Difference between method overloading and method overriding in java? . .. 9. 6) Difference . Core java Interview questions on Coding Standards. + Multiple Choice Questions & Answers in Java with explanations Anyone preparing for aptitude test in Java (both objective type test and Java coding.
|Language:||English, Spanish, French|
|Genre:||Children & Youth|
|ePub File Size:||24.37 MB|
|PDF File Size:||16.39 MB|
|Distribution:||Free* [*Sign up for free]|
Java Programming questions and answers with explanation for interview, download Java Programming quiz questions with answers as PDF files and eBooks. Java Aptitude Questions in portal7.info for more Java Aptitude Questions to download in pdf format. i want java aptitude questions with answers. Posted by Arnab. PDF | This book is intended to serve those who have just started in the “gaps” by answering several „wh y‟ and „how to‟ questions in Java.
Many types: Class Method Area: Class Area stores per-class structures such as the runtime constant pool, field, method data, and the code for methods. Heap: It is the runtime data area in which the memory is allocated to the objects Stack: Java Stack stores frames. It holds local variables and partial results, and plays a part in method invocation and return. Each thread has a private JVM stack, created at the same time as the thread. A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes. Program Counter Register: PC program counter register contains the address of the Java virtual machine instruction currently being executed.
Which of these packages contain all the collection classes? Collections Questions and Answers 2. Collections Questions and Answers 3. Collections Questions and Answers 4. Which of these methods deletes all the elements from invoking collection?
Collections Questions and Answers 5. What is Collection in Java? When does Exceptions in Java arises in code sequence? Which of these keywords is not a part of exception handling?
Which of these keywords must be used to monitor for exceptions? Which of these keywords is used to manually throw an exception?
Input Output Streams Questions and Answers 1. Input Output Streams Questions and Answers 2. Input Output Streams Questions and Answers 3.
Which of these is a type of stream in Java? Input Output Streams Questions and Answers 4. Which of these classes are used by Byte streams for input and output operation? Input Output Streams Questions and Answers 5. Which of these classes are used by character streams for input and output operations? Which of these keywords is used to define interfaces in Java?
Which of these can be used to fully abstract a class from its implementation? Which of these access specifiers can be used for an interface? Which of these keywords is used by a class to use an interface defined previously? Which of the following is correct way of implementing an interface salary by class manager?
Which of these class is not a member class of java. Which of these interface is not a member of java. Which of these class is not related to input and output stream in terms of functioning? Which of these is specified by a File object? Which of these classes is not included in java. Which of these is a process of converting a simple data type into a class? Which of these is wrapper for simple data type float? Which of these standard collection classes implements a dynamic array?
Which of these method can be used to increase the capacity of ArrayList object manually? Which of these method of ArrayList class is used to obtain present size of an object?
Which of these methods can be used to obtain a static array from an ArrayList object? Packages Questions and Answers 1.
Which of these keywords is used to define packages in Java? Packages Questions and Answers 2. Which of these is a mechanism for naming and visibility control of a class and its content? Packages Questions and Answers 3.
Packages Questions and Answers 4. Packages Questions and Answers 5. Serialization Questions and Answers 1.
Which of these is a process of writing the state of an object to a byte stream? Serialization Questions and Answers 2. Which of these process occur automatically by java run time system? Serialization Questions and Answers 3. Which of these is an interface for control over serialization and deserialization? Serialization Questions and Answers 4. Which of these interface extends DataOutput interface?
Serialization Questions and Answers 5. Strings Questions and Answers 1. Which of these class is superclass of String and StringBuffer class? Strings Questions and Answers 2.
Which of these operators can be used to concatenate two or more String objects? Strings Questions and Answers 3.
Which of these method of class String is used to obtain length of String object? Strings Questions and Answers 4. Strings Questions and Answers 5. Which of these constructors is used to create an empty String object?
Which of these method is used to find out that a thread is still running or not? The thread is available in java. We can overload the run method in our class.
For that we should provide the implementation for run method which is defined in the interface. Ans: Join method is used to join one thread with the end of the currently running thread. When it reaches the code t. Once it reaches the code t. It is a non-static method. Join method has overloaded version. Q 41 What does yield method of the Thread class do? So that equal priority threads have a chance to run.
It is a static method. Yield method moves the thread back to the Runnable state only, and not the thread to sleep , wait or block. Ans: wait method is used to make the thread to wait in the waiting pool. When a wait method is executed during a thread execution then immediately the thread gives up the lock on the object and goes to the waiting pool. Wait method tells the thread to wait for a given amount of time.
Then the thread will wake up after notify or notify all method is called. Wait and the other above-mentioned methods do not give the lock on the object immediately until the currently executing thread completes the synchronized code.
It is mostly used in synchronization. Ans: Given below are few differences between notify method and notifyAll method notify notifyAll This method is used to send a signal to wake up a single thread in the waiting pool. This method sends the signal to wake up all the threads in a waiting spool. Q 44 How to stop a thread in java? Explain about sleep method in a thread? Ans: We can stop a thread by using the following thread methods.
Sleeping Blocked Sleep: Sleep method is used to sleep the currently executing thread for the given amount of time. Once the thread is wake up it can move to the runnable state. So sleep method is used to delay the execution for some period.
Example: Thread. Sleep So it delays the thread to sleep 2 milliseconds. Ans: If we need our class to extend some other classes other than the thread then we can go with the runnable interface because in java we can extend only one class.
If we are not going to extend any class then we can extend the thread class.
Q 46 Difference between start and run method of thread class. Ans: Start method creates new thread and the code inside the run method is executed in the new thread. If we directly called the run method then a new thread is not created and the currently executing thread will continue to execute the run method.
Q 47 What is Multi-threading?