It's been a long time since I shared any Java Error or Exception troubleshooting tutorial so here we are. In this post, we will take a look at the "java.lang.OutOfMemoryError: unable to create new native thread" error which is a rate but quite possible in multithreading Java applications. This is another Java OutOfMemoryError that comes when JVM hits the native thread limitation allowed to be open by one process and not able to create any more new threads. Since each Java thread is associated with the OS thread, when OS refuses to provide a new thread, JVM throws OutOfMemoryError. It's rarely you will see common Java applications throwing this error but it's common when multiple application is using the same Java process e.g. Web Server Tomcat and a significant number of threads are allocated due to high load.
Thursday, February 23, 2023
How to display full command a Running Process in Linux and Solaris? Example
One of the problems with ps command, which is a popular tool to find any processes along with the grep command in the Solaris operating system is that it doesn't show full command-line argument of process. This means if you are doing grep on any text which appears at the tail end of the long command line, you will likely not able to capture that process by using ps and grep. This is dangerous because it may lead you to assume that certain process is not running and you may restart it again, despite its being running and only because you didn't find the process.
Labels:
debugging
,
linux
,
troubleshooting
,
unix
Friday, February 17, 2023
Top 10 Testing Tools and Libraries for Java Developers in 2024 [UPDATED]
In the last couple of weeks, I have written quite a few articles about what Java developers should learn in 2024 like programming languages, libraries, and frameworks, but if you have just one thing to improve or learn then that must be your testing skills. Testing is one of the disciplines which separates professional developers from amateur ones. It's not about following Test-driven development (TDD), Business Driven Development (BDD), or whatever testing methodologies but at the very minimum level, you must write code to test your code automatically. Many Java developers write unit tests and integration tests that automatically run during build time, mostly by using continuous integration tools like Jenkins or TeamCity.
Labels:
best of javarevisited
,
online resources
,
programming
,
tools
Thursday, February 16, 2023
How to use var keyword to declare local variables in Java? Example Tutorial
Hello guys, In this series of new features of Java 10 articles, today, I am going to talk about probably the most popular and most useful, the introduction of var keyword (well, it's not really a keyword but I'll you later about it) in Java. If I am not wrong, this feature was supposed to come on Java 9 but dropped later. Finally, Java also has a var keyword to declare local variables which allows you to declare a variable without their type like instead of doing String str = "Java" you can now just say var str = "Java". This may not sound much gain when declaring String or an int variable but consider complex types with generics, this will surely save a lot of typing and also improves the readability of code.
How to Sort a List in Reverse Order in Java? ArrayList Example
Java Collection Framework provides a convenient reverse comparator, to
sort a List of objects in reverse order. You can obtain reverse Comparator, by
calling Collections.reverseOrder(), which by
default sort List of Integer in reverse
numeric order and List of String in reverse alphabetic order. It
actually reverses the natural ordering of objects imposed by the Comparable interface. Apart from this method, Collections class also
provides an overloaded method Collections.reverseOrder(Comparator
cmp) , which takes a Comparator,
and sorts List on reverse order of that Comparator.
Labels:
core java
,
java collection tutorial
,
programming
What is the real use of Method overloading in Java and Object Oriented Programming? Example
Many programmers, including Java and C++ developer, knows about the object oriented programming concepts like method overloading or function overloading, but if you ask them why you should overload a method? Many of them become clueless. This is a common problem of half learning i.e. you know the concept but you don't know the application. If you neither know what problem it solves nor what benefit it provides, then just knowing the concept is not enough. You won't be able to reap all benefits if you just know the concept and never use that in practice. If you are wondering what is the real use of method overloading then don't worry, I will share the answer in this article. Btw, this is also one of the popular object oriented programming interview question and its good to know about it.
Labels:
core java
,
object oriented programming
Tuesday, February 14, 2023
Top 10 Tools and Technologies App Developers can Learn in 2024 [UPDATED]
Hello guys, Mobile app development is a lucrative field for programmers as it has all kinds of opportunities, from freelancing to working at large companies and launching your own apps like Angry Bird, Flappy Bird, or Pokemon Go and becoming an App millionaire also known as Appreneur. If one of your goals in 2024 to learn Mobile application development and you wondering how to start, then you have come to the right place. In this article, I am going to share 10 tools, frameworks, and technologies you can learn to become a mobile application developer or someone who wants to improve as a mobile application developer for Android and iOS platforms can learn in 2024. This list includes things like framework, programming languages, and platforms, almost everything a mobile developer needs.
Labels:
android
,
best of javarevisited
,
iOS development
,
mobile
Friday, February 10, 2023
How to get Id of an HTML and DOM object in jQuery? Example Tutorial
As a page author, the id of an HTML element is something you should know. Still, there are scenarios when the page is automatically generated, or maybe some form elements are generated by using frameworks like JSF. In that case, what do you do if you want to find an id attribute of some elements in the page programmatically? How do you find those ids using jQuery? There are several ways to solve this problem, a couple of them in this article itself. The jQuery API provides many methods to get any attribute or property, including the id of an HTML element programmatically.
Labels:
JavaScript
,
JQuery
Saturday, February 4, 2023
How to use State Design Pattern in Java? Vending Machine Example
The State design pattern is a behavioral pattern, first introduced by GOF in their class is book design patterns. State pattern looks similar to Strategy pattern but it helps in managing object state and thus enabling them to behave differently in a different state. In this example, we will take a famous object-oriented design interview question, implementing Vending Machine in Java. In the past, we have solved this problem without using any design pattern, but here we will use state design patterns to create a vending machine with different states. This example will not just help you to understand how to implement State Design Pattern in Java but also gives you experience about when to use State Pattern on your application.
Labels:
core java
,
design patterns
,
interview questions
Wednesday, February 1, 2023
Difference between Statement vs PreparedStatement vs CallableStatement in Java JDBC
Hello Java programmers, if you are looking to find out the difference between Statement, PreparedStatement, and CallableStatement in Java then you have come to the right place. Earlier, I have shared common JDBC Interview Questions and in this article, I am going to explain what is the real difference between these Statement types in Java and when to use Statement, PreparedStatement, and CallableStatement in Java programs. JDBC API provides several classes and interfaces for various things, but three of the most important types of Statement classes are Statement, PreparedStatment, and CallableStatement. They are designed to execute different types of SQL queries.
Labels:
core java interview question
,
JDBC
Subscribe to:
Posts
(
Atom
)