Python OOP. Exception Handling. File handling. Python Regex. Python Collections. Python Advance. Python NumPy. Python Pandas. Python Django.
Not many questions from NIO or Exception handling and data structures. I would love to ask how a Java developer will use fundamental data structure e. Good Job Javin, keep it up, you are inspiration for many Java developers. Why should someone remember the syntax and code for formatting date or time zone in an interview? Arent these kind of questions pointless?? Anonymous, it's not about remember syntax and cod, but its about experience. It's perfectly ok to check if candidate has ever used Date, Time and TimeZone features in Java or not.
Given they are very important concept, you surely don't want to overlook them. Nice set of questions. Surely it will help for fresher's as well as experienced candidates. Dear author please keep it up. Thanks Prakash, if you like please share with your friends and colleagues, it does make a difference. Thank you very much for posting. Golam, that will happen only the object is not of the class you are converting e..
The relationship is just to satisfy compiler. See my post how type casting work in java to learn more. Please help me if any courses available on Udemy or any other site or url to learn. Thanks for understanding. The String is Immutable in java because java designer thought that string will be heavily used and making it immutable allow some optimization easy sharing same String object between multiple clients.
See the link for the more detailed answer. This is a great question for Java programmers with less experience as it gives them food for thought, to think about how things works in Java, what Jave designers might have thought when they created String class etc. Nice list but problem solving questions are missing.
Just to add my 2 cents, Here are some Problem Solving Questions you can ask Java developers to check their problem solving skills: 1 A user issues a web service call and nothing is returned. Please describe the steps you would take to figure out why no data is returned. How would you determine why it may have gone down 3 You see we ran out of disk space what do you do 4 You are experiencing delay in web service response? How do you troubleshoot and fix?
You can check the approach, knowledge and experience from their answers. Post a Comment. Time is changing and so is Java interviews. Gone are the days, when knowing the difference between String and StringBuffer can help you to go through the second round of interview, questions are becoming more advanced and interviewers are asking more deep questions.
When I started my career, questions like Vector vs Array and HashMap vs Hashtable were the most popular ones and just memorizing them gives you a good chance to do well in interviews, but not anymore. Nowadays, you will get questions from the areas where not many Java programmer looks e. NIO, patterns, sophisticated unit testing or those which are hard to master e. Since I like to explore interview questions, I have got this huge list of questions with me, which contains lots and lots of questions on different topics.
Java Speech supports speech synthesis which means the process of generating spoken the language by machine on the basis of written input. It is important to keep in mind that Java Speech is only a specification i. Thus third-parties provide the implementations. The javax. The package javax. We will understand that what is required for java API to convert text to speech. This will create a jar file by the name jsapi. Answer : The yield method belongs to the thread class. It transfers the currently running thread to a runnable state and also allows the other threads to execute.
In other words, it gives equal priority threads a chance to run. Because yield is a static method, it does not release any lock. Answer : The thread lifecycle has the following states and follows the following order:.
Answer : In Java, it is possible to extend only one class. Hence, the thread class is only extended when no other class needs to be extended. If it is required for a class to extend some other class than the thread class, then we need to use the Runnable interface. Answer : The notify method is used for sending a signal to wake up a single thread in the waiting pool.
Contrarily, the notifyAll method is used for sending a signal to wake up all threads in a waiting pool. Answer : There are several fundamental differences between a process and a thread, stated as follows:. Answer : We use the join method for joining one thread with the end of the currently running thread. It is a non-static method and has an overloaded version. Consider the example below:. The main thread starts execution in the example mentioned above.
As soon as the execution reaches the code t. The JVM switches between the main thread and the thread there. Once the execution reaches the t. Afterward, the main thread resumes execution.
Declaring the throws keyword — We can declare the exception using throws keyword at the end of the method. For example:. Upon the occurrence of the exception, it is caught by the catch block that follows the try block. For example,. Answer : Yes, it is possible to write several catch blocks under a single try block.
However, the approach needs to be from specific to general. Following example demonstrates the same:. Answer : While the throws keyword allows declaring an exception, the throw keyword is used to explicitly throw an exception. Checked exceptions can't be propagated with throw only, but throws allow doing so without the need for anything else.
The throws keyword is followed by a class, whereas the throw keyword is followed by an instance. The throw keyword is used within the method, but the throws keyword is used with the method signature. Furthermore, it is not possible to throw multiple exceptions, but it is possible to declare multiple exceptions. There is two crucial exception handling keywords in Java, followed by the third keyword final, which may or may not be used after handling exceptions.
If and when a code segment has chances of having and abnormality or an error, it is placed within a try block. When the exception is raised, it is handled and caught by the catch block. This block is executed regardless of the exception.
Answer: The method at the top of the stack throws an exception if it is not caught. It moves to the next method and goes on like this until caught. If an exception occurred in the add method is not caught, then it moves to the method addition. It is then moved to the main method, where the flow of execution stops. It is called Exception Propagation.
Answer: Yes, Java permits to save our java file by. It is compiled by javac. Answer : A group of objects in Java is known as collections.
Alternatively, collections can be considered as a framework designed for storing the objects and manipulating the design in which the objects are stored. You can use collections to perform the following operations on objects:. Values contained in a HashTable are unique and depend on the key.
Methods are not synchronized in HashMap, while key methods are synchronized in HashTable. However, HashMap doesn't have thread safety, while HashTable has the same. For iterating values, HashMap uses iterator and HashTable uses enumerator. HashTable doesn't allow anything that is null, while HashMap allows one null key and several null values.
In terms of performance, HashTable is slow. Comparatively, HashMap is faster. Answer : A Java Map is an object that maps keys to values. It can't contain duplicate keys, and each key can map to only one value. In order to determine whether two keys are the same or distinct, Map makes use of the equals method.
There are 4 types of Map in Java, described as follows:. Answer : Priority queue, like a regular queue, is an abstract data type except having a priority associated with each element contained by it.
The element with the high priority is served before the element with low priority in a priority queue. Elements in a priority queue are ordered either according to the comparator or naturally.
The order of the elements in a priority queue represents their relative priority. Answer : In Java, a Set is a collection of unique objects. It uses the equals method to determine whether two objects are the same or not. Various types of Set in Java Collections are:. It means that values are stored in a collection in a specific order, but the order is independent of the value. Answer : If several threads try to access a single block of code, then there is an increased chance of producing inaccurate results.
The Supplier is a functional interface that returns an object. It's similar to the factory method or new , which returns an object. The Supplier has get functional method, which doesn't take any argument and return an object of type T.
This means you can use it anytime you need an object. Since it is a functional interface, you can also use it as the assignment target for a lambda expression or method reference. A Consumer is also a functional interface in JDK 8, which represents an operation that accepts a single input argument and returns no result. Unlike other functional interfaces, Consumer is expected to operate via side-effects. The functional method of Consumer is accept T t , and because it's a functional interface, you can use it as the assignment target for a lambda expression or method interface in Java 8.
0コメント