Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
Top 21 jQuery interview Questions and Answers
Top 21 Maven Interview Questions Answers for Java Developers
Hello guys, for a Java developer, Maven in one of the essential tool and its used to build your Java application. Since most of the Java projects used Maven for building, it is expected from a Java developer that he knows Maven and knows it well. That's why Maven questions are quite common on Java developer interviews but I have seen many Java programmers coming to these interview unprepared and not able to answer most of the questions on tools like Maven, Gradle or even git. When I asked one candidate why don't you prepare for Maven before your Java interviews, he said, I wasn't able to find any list of Maven questions.
How to enable or disable form elements using jQuery? Examples
In last couple of tutorials you have learned how to get all selected checkbox and radio buttons, and in this tutorial, you will learn how to enable/disable form elements using jQuery. A form element e.g. a textfield, radio buttons and checkbox, all represented using input tag can be enabled or disabled by adding an attribute called "disabled". It's similar to "checked" attribute we have seen for checkbox and radio buttons. If this attribute is not present then element is enable, but if this attribute is present then you can use disabled=true to disable the form element and disabled=false to enable the form elements as shown in our example. Like previous example of checking/unchecking checkbox, you can use prop() jQuery function to enable/disable form element if you are running on jQuery 1.6 or higher version and attr() function if you are running on jQuery 1.5 or lower version.
How to shuffle a List in Java? Collections.shuffle() Example
How to Compare Two Dates in Java? Check If They Are Equal, Later or Earlier - Examples
What is transient variable in Java? Serialization Example
Difference between HashSet and HashMap in Java? Answered
Hello friends, if you have given Java developer interview then there is good chance that you may have come across questions like Difference between HashSet vs HashMap or HashSet vs TreeSet etc. In this article, we are going to discuss differnece between HashMap and HashSet, two of the popular Collection classes from JDK. The HashSet vs HashMap is a classical Java Collection interview question that focuses on What are differences between HashSet and HashMap in terms of features, usage, and performance. If you are in Java programming even for a year or so, you are likely to be familiar with What is HashSet in Java and What is HashMap in Java, these two are the most popular collection classes.
What is PATH and CLASSPATH in Java? Path vs ClassPath Example
The PATH and CLASSPATH are the two most important environment variables of the Java environment which are used to find the JDK binaries used to compile and run Java in windows and Linux and class files which are compiled Java bytecodes. From my personal experience I can say that PATH and CLASSPATH are the two most problematic things for beginners in Java programming language due to two reasons; first because in most Java courses nobody tells details of what is a PATH and CLASSPATH, What do PATH and CLASSPATH do, What is meaning of setting PATH and CLASSPATH, What happens if we do not set them, Difference between PATH vs CLASSPATH in Java or simply How Classpath works in Java, etc.
Why is main method public, static, and void in Java? Answer
The main() method in Java is a special method that is used by JVM to start the execution of any Java program. The main method is also referred to as the entry point of Java application which is true in the case of core Java applications because execution starts from the main() method, but in the case of container-managed environments like Servlet, EJB, or MIDlet this is not true as these Java programs have their own life-cycle methods like init(), service() or destroy() for Servlet's which is used by the container. The main method in Java is run by the main thread which is a non-daemon thread and the Java program runs until the main method finishes or any other user thread is running.
How to convert JSON String to Java Object using Gson? JSON Deserialization Example
Difference between var, val, and def in Scala? Examples
3 ways to convert String to JSON object in Java? Examples
Difference between Correlated and Non-Correlated Subquery in SQL? Examples
How to sort ArrayList in Java? Examples
What is final modifier in Java? fina class, method, and variable example
Best way to Convert Integer to String in Java with Example
How to create a ZIP File in Java? ZipEntry and ZipOutputStream Compression Example
How to add JAR files in Eclipse Project's Build path? Example
5 Tips to Fix Exception in thread "main" java.lang.NoClassDefFoundError in Java, Examples
The Exception in thread "main" java.lang.NoClassDefFoundError is a common error in Java that occurs if a ClassLoader cannot find a particular class in the classpath while trying to load it. The Exception in thread "main" suggests that this error has occurred in the main thread, the thread which is responsible for running the Java application. This error can occur to any thread, but if it happens in the main thread, then your program will crash because Java program runs only until main() thread is running or any other non-daemon thread is running. As per Javadoc, NoClassDefFoundError can be thrown during the linking or loading of the class file.
14 Enum Interview Questions and Answers for 1 to 2 Years Experienced Java Programmers
How to convert String to char in Java? Example Tutorial
How to get current TimeStamp value in Java? Example
5 Difference between String, StringBuffer, and StringBuilder in Java
Difference between include() and forward() methods of RequestDispatcher in Servlert
Base64 Encoding and Decoding Examples in Java 8 and Before
How Java achieves platform independence? Answer
10 Difference between Struts 1.x and Struts 2.x framework in Java
When You should Not use Microservice Architecture? (Answer)
Hello guys, recently while giving interview in one of the big US based Investment bank I was asked about, what are the scenarios when you shouldn't be using Microservices architecture? When I hear this question I was big surprised not because I didn't know the answer but because most of the people ask about using Microservice architecture and this was the first time I am hearing otherwise. To be honest, it's a good question because most of the candidate will prepare about benefirst about Microservice architecture and they may not know when it's not appropriate to use it. Since I have worked in low latency high frequency application, I knew that multiple process means more latency so clearly a Microservices is a big no if you are working on a high frequency low latency application. In those cases you want to do all your calculations inside a single thread or process without even swapping memory to avoid delay. Hence the first answer to this question was, you shouldn't be using Microservice in a low latency application.
10 Examples of Comparator, Comparable, and Sorting in Java 8
The Comparator class is used to provide code or logic for comparing objects in Java, while sorting a list of objects or a collection of objects. It's close cousin of Comparable which provides natural order sorting e.g. ascending and descending orders for numbers like int, short, long or float, and lexicographic order for String i.e. the order on which words are arranged in dictionaries. The Comparators are used while sorting arrays, lists and collections. You pass logic to compare objects and sorting methods like Collections.sort() use that logic to compare elements until they are arranged in sorted order.
Difference between static and instance member variables in Java? Answer Example
23 Java Static Class, Methods and Variables Interview Questions with Answers
Top 20 Abstract Class and Method Interview Questions and Answers in Java
Top 6 books to learn Java Virtual Machine, Garbage Collection, and Performance [UPDATED]
Top 5 Design Patterns Books for Java Developers - Best of Lot
Top 5 Books to learn SQL and Database Design in 2024 - Best of Lot
Top 10 Free Python Programming Books - Download PDF or Read Online
Top 6 Django Python Courses for Beginners to Learn Online in 2024 [UPDATED]
Top 7 Free Maven and Jenkins Online Courses for Java Programmers in 2024 [ UPDATED]
Top 5 Books to Learn Hibernate for Java Developers in 2024 - Best of Lot
Top 5 Books to Improve Coding and Programming Skills - Must Read, Best of Lot
Top 5 Free AWS Developer Associate Certification DVA-C02 Courses in 2024 - Best of Lot
3 Best Books to Learn Java Programming for Beginners
10 Free Courses to Learn Data Structure and Algorithms in Java, Python, and C++ in 2024 [UPDATED]
Top 10 Books Every Programmer Should Read
Top 5 Books to learn React.js for Beginners in 2024 - Best of Lot
Top 5 Spring Framework Books for Java developers (Includes Spring Security and Spring Boot) - Best of lot
Top 10 Algorithms books Every Programmer Should Read
Top 10 Java Online Courses and Tutorials for Beginners in 2024 [UPDATED]
Hello everyone! if you want to learn Java Programming and become a Java Programmer in 2024 and looking for the best resources like books, online courses, tutorials, projects, and websites, you have come to the right place. Earlier, I have shared the best Java books for beginners, best Java websites, best Java tutorials, and free Java courses. Today, we will go through some of the best online courses for learning the Java Programming language. These Java online courses are curated from top websites and learning platforms like Coursera, Udemy, Educative, CodeCademy, Javaespecialist, etc.
Top 5 Free Database and SQL Query Courses for Beginners to Learn Online in 2024 - Best of Lot
Top 6 Free Courses to Learn TypeScript in 2024 - Best of Lot
8 Free Linux Courses for Programmers and IT Professionals to Learn Online [2024]
Top 5 Free R Programming Courses for Beginners in 2024 - Best of Lot
How to replace an element of ArrayList in Java? Example
3 Difference between Web Server vs Application Server vs Servlet Containers - Apache vs JBoss vs Tomcat
What is the difference between byte and char data types in Java? Example
Difference between ArrayList and HashSet in Java? Answer with Example
4 ways of Session management in Servlets, JSP, and Java Web Applications
String to Enum in Java - Example
You can create Enum from String by using Enum.valueOf() method. valueOf() is a static method that is added on every Enum class during compile-time and it's implicitly available to all Enum along with values(), name(), and cardinal() methods. In order to create Enum from String, String must be the same as declared Enum otherwise, the code will throw "java.lang.IllegalArgumentException: No enum const class". the same technique can be used to convert String into Enum instance as well.
9 difference between static vs non-static method in Java - Answer
How to Add Elements of two Arrays in Java - Example
How to read a text file into ArrayList in Java? Examples
6 Difference between forward() and sendRedirect() in Servlet - Answer
java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.JasperException: java.lang.IllegalStateException: getOutputStream() has already been called for this response
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:424)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
HelloServlet.doGet(HelloServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
and here is the root cause :
3 ways to Copy a File From One Directory to Another in Java, Examples
How to read a text file as String in Java? Example
How to convert Enum to String in Java with Example
How to Increase Heap Size of Java Program running in Eclipse [Example]
-Xms<size> to set the initial Java heap size
-Xmx<size> to set the maximum Java heap size
-Xss<size> to set the java thread stack size
$ java -Xms1G -Xmx2G MainClass
In the above line, we have set the minimum heap size to 1GB and the maximum heap size to 2GB.
How to fix java.lang.IllegalStateException: getWriter() has already been called for this response [Solution]
Difference between jsp:include and jsp:forward action- Example
<jsp:forward page="URL" />
How to get Current Date and Time in Java with Example
How to convert java.util.Date to java.sql.Timestamp in Java - JDBC Example
How to Run a JAR file from Command Prompt - Windows and UNIX [Example]
What is default Serialization in Java? Serializable and Externalizable Interface Explanation
Serialization in Java is a process to persist any Java Object's state into a File System or convert them into a byte stream to transfer over the network to another JVM or program. Serialization in Java is done by JVM by employing the default Serialization process which persists all of the Object's state except the transient variable and a static variable. How Serialization works in Java is another popular Java Serialization interview question, well It's easy to make any Java class Serializable, the class needs to implements java.io.Serializable interface, and JVM will automatically serialize its instance when passed over to java.io.ObjectOutputStream using writeObject().
How to use Enum in Java? Example
Why you shouldn't use == with float and double in Java?
For example, the following code will not work as you expect :
for(double balance = 10; balance!=0; balance-=0.1) { System.out.println(balance); }
How to load data from CSV file in Java - Example
6 Difference between include directive and include action in JSP
Even though both include directive and include action allows you to include the response of one JSP into another, they are quite different from each other e.g. include directive is processed at translation time and used to include the static resources e.g. HTML files, images, and CSS, etc, while the <jsp:include> action is processed at request time and used to include more dynamic resources e.g. JSP or Servlet. What is the difference between include directive and include action is also one of the most popular JSP interview questions, mostly asked either at telephonic round or first few round of Java web developer interviews?
Top 5 Free Courses to Learn C Programming for Beginners in 2024 - Best of Lot
Top 5 Python Books for Beginners to Learn Programming in 2024 - Best of Lot
Thread-safe Singleton in Java using Double Checked Locking Idiom
How to convert float to int in Java? Examples
How to use BigInteger class in Java? Large Factorial Example
How to set JAVA_HOME (PATH) in Mac OS? Example Tutorial
export JAVA_HOME=`/usr/libexec/java_home` (remember backticks)or
echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" >> ~/.bash_profile
This will append export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" into your bash_profile file. If you have set JAVA_HOME in UNIX then it's exactly similar to that.