jQuery Tutorial - How to modify multiple HTML elements in one line

05/14/2017 05:04:00 AM

jQuery allows you to modify multiples elements in one go, you can modify attributes, text, or color of multiple HTML elements by executing just one line of jQuery code. In this jQuery tutorial, I will show you how to modify multiple elements ...

Can you take Spring certification without Pivotal Training Course?

05/13/2017 01:48:00 AM

Yes, you can take Spring certification without taking mandatory Spring training. Pivotal, the company behind Spring, has announced on 10th May 2017 that "Spring Certification Exams are now available for individual purchase, without enrolling ...

Solution of java.lang.OutOfMemoryError: GC overhead limit exceeded

05/11/2017 21:21:00 PM

The java.lang.OutOfMemoryError: GC overhead limit exceeded is another type of OutOfMemoryError in Java which comes when JVM spent too much time doing garbage collection without any success.  For example, if almost 98% of CPU for a Java process ...

How to enable Spring Security in Java Web application?

05/10/2017 07:19:00 AM

Spring Security is one of the most popular frameworks to implement security in Java web application in a declarative way. It provides several essential security features e.g. LDAP authentication, authorization, role-based access control,  ...

How to print 1 to 100 without using loop in Java

05/08/2017 21:00:00 PM

This is one of the interesting problems  I have seen on coding interviews  for beginners. The program has surprise element by saying that you need to print 1 to 100 without using a loop e.g. for, forEach or enhanced for loop. This brings out ...

Difference between Servlet and JSP?

05/06/2017 23:39:00 PM

Servlet and JSP are two of the most popular Java web technologies to generate dynamic content in Java web applications there is some key difference between them. For example, Servlet is designed for Java developers as most of the coding is done ...

Top 10 Free Java Programming Books, EBooks and PDF download

05/06/2017 01:46:00 AM

Who doesn't like free stuff? Well, I do like and many Java programmers like me simply love free Java books, eBooks, and PDFs. Fortunately, the Internet is full of free books and eBooks but unfortunately, many of them are of not good quality. ...

Which Java 8 Certification Should you Take? OCAJP8 (1Z0-808) , OCPJP8 (1Z0-809) , or Upgrade(1Z0-810 and 1Z0-813)

05/04/2017 20:34:00 PM

There are a lot of confusion among Java programmers and Oracle Java Certification aspirants related to various Java 8 certifications e.g. what are exam codes, which exams they should go for, whether they are eligible for Java SE 8 upgrade exams, ...

Top 4 Books to Learn Java for Beginners (Newbie)

05/03/2017 10:29:00 AM

I receive lots of emails and Facebook chats related to Java, but one of the most common questions which I have mostly asked is, which is the best book to learn Java? I have just started learning Java, Could you please recommend a good core Java ...

Cause of "java.lang.SecurityException: Missing required Permissions manifest attribute in main jar" [Solved]

05/01/2017 19:39:00 PM

If you are working Java Web start application using JNLP and suddenly started throwing "java.lang.SecurityException: Missing required Permissions manifest attribute in the main jar", then check whether you have updated the Java or JRE on your ...

Difference between Struts ValidatorForm vs ValidatorActionForm - Interview Question

04/30/2017 21:14:00 PM

Struts provide two classes ValidatorForm and ValidatorActionForm for validating form fields. Instead of doing basic validation by using the validate() method in Action class, these classes allows you to leverage rich feature of validation framework ...

Difference between PriorityQueue and TreeSet in Java?

04/29/2017 23:47:00 PM

The PriorityQueue and TreeSet collection classes has a lot of similarities e.g. both provide O(log(N)) time complexity for adding, removing, and searching elements, both are non-synchronized and you can get element from both PriorityQueue and ...

Difference between Transient, Persistent, and Detached Objects in Hibernate

04/29/2017 00:30:00 AM

In Hibernate framework, an entity can be in three states, transient, persistent, and detached. When an object is in transient state, it is commonly refereed as transient object, similarly if it is in persistence and detached state, it is known ...

Top 5 FREE eBooks to Learn jQuery Online or download PDF

04/27/2017 10:03:00 AM

Everybody loves free resources, don't you? Well, I do and that's why I am always in search of good free resources e.g. eBooks and training courses. In the last article, I have shared some of the free JavaScript books and this time I am sharing ...

Difference between @Autowired and @Inject annotation in Spring?

04/26/2017 10:49:00 AM

What is the difference between @Autowired and @Inject annotation in Spring is one of the frequently asked questions on Spring interviews? Since everybody is now moved or moving to annotation driven, Java configuration in Spring, this question ...

Difference between CAST, CONVERT, and PARSE function in Microsoft SQL Server

04/25/2017 10:48:00 AM

Though all three, CAST, CONVERT and PARSE are used to convert one data type into another in SQL Server, there are some subtle differences between them.The  CAST method accepts just two parameters, expression, and target type, but CONVERT() ...

Difference between repaint and revalidate method in Java Swing

04/24/2017 10:13:00 AM

What is the difference between revalidate() and repaint() in Java Swing is one of the popular Swing Interview Questions especially on Investment banks? Though both methods sound similar, there is a subtle difference between them. the revalidate() ...

OCAJP 1Z0-808 - Best Books and Mock Exams for Java 8 OCA Certification

04/23/2017 06:50:00 AM

From the last couple of months, I have been helping few developers to prepare for Java 8 associate certification with exam code 1Z0-808, also known as OCAJP 8. From my experience, both for preparing for Sun certification and helping other developers ...

Recursive Binary Search Algorithm in Java - Example Tutorial

04/22/2017 08:16:00 AM

The binary search algorithm is one of the most famous search algorithms in computer science. It allows you to search a value in logarithmic time i.e. O(logN), which makes it ideal to search a number in a huge list. For example, in order to search ...

Top 10 Java books of last 5 Years For Experienced Programmers

04/21/2017 10:28:00 AM

If you think you have read all important books on Java and don't have anything new to read then hang on. Java is changing continuously, now Java 9 is on the way, but more importantly, it has already changed a lot in last 5 to 6 years with major ...

Can we declare a class Static in Java?

04/20/2017 10:35:00 AM

The answer to this question is both Yes and No, depending on whether you are talking about a top level class or a nested class in Java. You cannot make a top level class static in Java, the compiler will not allow it, but you can make a nested ...

Log4j Tips : Use MDC or Mapped Dignostic Context to distinguish logging per Client or Request

04/19/2017 10:01:00 AM

The MDC or Mapped Diagnostic Context is a concept or feature of Log4j logging library which can be used to group related log messages together. For example, by using MDC you can stamp a unique identification String like clientId or orderId on ...

Difference between ArrayList and ArrayList in Java - Raw Type vs Wildcard

04/18/2017 03:50:00 AM

One of my readers asked me about the difference between ArrayList vs ArrayList, which was actually asked to him on a recent Java development interview. The key difference between them is that ArrayList is not using generics while ArrayList is ...

Difference between Abstraction and Encapsulation in Java - OOP

04/17/2017 09:22:00 AM

Both Abstraction and Encapsulation are two of the four basic OOP concepts which allow you to model real-world things into objects so that you can implement them in your program and code. Many beginners get confused between Abstraction and E ...

How to compare two XML files in Java - XMLUnit Example

04/16/2017 06:48:00 AM

The XMLUnit library can be used to compare two XML files in Java. Similar to JUnit, XMLUnit can also be used to test XML files for comparison by extending the XMLTestcase class. It is a rich library and provides a detailed comparison of XML ...

Top 5 books to Learn Object Oriented Programming - Must Read, Best of Lot

04/15/2017 09:20:00 AM

The OOP or Object Oriented Programming is one of the most popular  programming paradigms which helps you to organize code in re the l world system. It's a tool which helps you to write complex software by thinking in terms of objects. Unlike ...

10 Examples of CUT command in UNIX and Linux

04/14/2017 09:56:00 AM

The cut command in UNIX is a nice utility program which allows you to cut data from a text file. The Linux cut command allows you to cut data by character, by field or by column. if used correctly along with sed, find, or grep in UNIX, the cut ...

Java Program to Multiply Two Matrices - Matrix Multiplication Example

04/13/2017 07:34:00 AM

How to write a Java program to multiply two matrices in Java is a very good programming exercise to get familiar with the two-dimensional array in Java. this example teaches about how to multiply arrays, how to access elements from a multi- ...

How hostname to IP address Conversion or Name Resolution works in Linux?

04/12/2017 09:56:00 AM

One of my favorite Linux Interview questions is about how to convert hostname to IP address in Linux? This questions not just test candidate's basic Linux command skills but also shows his understanding of how name resolution works in UNIX or ...

JAXB Date Format Example using Annotation | Java Date to XML DateTime String Conversion

04/11/2017 06:28:00 AM

One of the common problem while marshaling Java object to XML String using JAXB is the default format of date and time provided by JAXB. When JAXB converts any Date type object or XMLGregorianCalendar to XML String, precisely xsd:dateTime element, ...

10 Examples of Optional in Java 8

04/10/2017 08:43:00 AM

Null is bad, it can crash your program. Even it's creator called it a billion dollar mistake hence you should always try to avoid using nulls whenever you can. For example, you should not return a null String when you can return an empty String, ...

Does making all fields Final makes the class Immutable in Java?

04/09/2017 03:35:00 AM

One of the common misconceptions among many Java Programmer is that a class with all final fields automatically becomes Immutable. This is not correct, you can easily break immutability of certain class if the final field it contains is a mutable ...

How to Convert Map to JSON to HashMap in Java? Example Tutorial

04/08/2017 04:42:00 AM

In the last couple of years, JSON slowly took over XML as preferred format to transfer data from client to server and vice-versa. Because of increasing usage of JSON, Java developers are also getting a good exposure of JSON. If you are writing ...

5 Books to Learn Scala and Functional Programming - Best of Lot

04/07/2017 09:56:00 AM

Scala is one of the relatively new programming languages which encompasses best practices of many programming languages. The biggest strength of Scala is that it provides a nice blend of object-oriented programming and Functional programming. ...

2 Free Oracle Certified Master Java Enterprise Architect (OCMJEA) 6 Mock Exams - 1Z0-807

04/04/2017 19:08:00 PM

The OCMJEA 6 or Oracle Certified Master Java Enterprise Architect Java EE 6 is one of the most respected Java certification. It is also the most toughest Java exam currently available. In order to get this certification, you need to pass not ...

5 Reasons Why Java's old Date and Caledar API was Bad

04/03/2017 23:32:00 PM

If you have been programming in Java for a couple of years then you may know that how bad was Java's Date and Calendar API was, I mean the java.util.Date and java.utill.Calendar was badly designed. Though Java has corrected it's mistake by ...

How to format Date in SQL Server and Sybase Example

03/29/2017 08:39:00 AM

How to format a date in SQL Server like in the "yyyymmdd" format? Suppose you have a date and time column in Sybase or Microsoft SQL Server,  which is displaying values in "Dec  31, 2011, 12:00 AM" and you want to display it in any particular ...

2 Practical Data Structure, Algorithm, and Design Interview Questions from Investment Banks - Java, C++, C#

03/28/2017 10:08:00 AM

No doubt that Data structure and algorithms are an integral part of any Programming job interview, including Java, C++ or any other programming language. In fact Data structure and algorithms are quite a favorite one and all top notch companies ...

Difference between Stack and Queue Data Structure in Java

03/27/2017 09:17:00 AM

Stack and Queue are two of important data structures in the programming world and have a variety of usage. As opposed to the array and linked list, which are considered as a primary data structure, they are a secondary data structure which can ...

10 Tools Used by Java Programming Developer in Day to day life

03/24/2017 08:20:00 AM

Every trade has their tools, and Java programming is no  exception. In fact, good knowledge of tools and mastery of using them, saves a lot of time in design, development, testing, debugging, and troubleshooting any production issue. In order ...

How to Reverse a linked list in Java using Recursion and Loops

03/23/2017 09:42:00 AM

There are a couple of algorithms exists to reverse a singly linked list in Java e.g. You can use the three-pointers approach or solve this problem using a stack, or simply using recursion without the external stack. As I had pointed out on the ...

Top 30 Scala and Functional Programming Interview Questions and Answers

03/21/2017 20:24:00 PM

Scala is a programming language which aims to provide best of both object-oriented programming and functional programming world. It not only allows you to  construct elegant class hierarchies for maximum code reuse and extensibility but also ...

What is difference between SQL, T-SQL and PL/SQL?

03/20/2017 07:34:00 AM

Today, we are going to see another common and interesting SQL interview question, what is the difference between SQL, T-SQL and PL/SQL? It is also one of the most common doubt among SQL beginners. It's common for programmers to think that why ...

Difference between First and Second Level Cache in Hibernate

03/19/2017 07:16:00 AM

If you have used Hibernate in past then you know that one of the strongest points of Hibernate framework is caching, which can drastically improve the performance of Java application's persistence layer if configured and used correctly. Hibernate ...

How to enclose a list of values into single quotes for SQL query - Use Microsoft Excel

03/18/2017 09:08:00 AM

Many times you get a list of values which you want to check in the database to confirm if they exist in your tables or to get more information bout them. For example, you got a list of 100 stocks and you want to check their last day closing ...

What is Method References in Java 8? An Example

03/13/2017 07:56:00 AM

Lambda expression allows you to reduce code compared to anonymous class to pass behaviors to methods, method reference goes one step further. It reduces code written in a lambda expression to make it even more readable and concise. You use lambda ...

Top 5 Advanced SQL Books for Experienced Programmers - Best of lot, Must read

03/11/2017 06:22:00 AM

If you an experienced programmer and know how to write SQL queries and database fundamentals but want to take your SQL and database skills to next level then you have a come to the right place. This is the second article about SQL books, In ...

How to Implement Stack in Java using Array and Generics - Example

03/08/2017 19:47:00 PM

The stack is one of the popular data structure which supports LIFO (Last In First OUT) operation. Due to LIFO advantage, you can use stack data structure to convert a recursive algorithm to an iterative one. Stack data structure is very easy ...

How to find largest and smallest number from integer array in Java

03/07/2017 19:40:00 PM

Today I am going to discuss one of the frequently asked programming interview questions to find the largest and smallest number from an integer array. This question is commonly asked on telephonic interviews and the first round for screening ...

Why we use Threads in Java?

03/06/2017 18:55:00 PM

In one word, we use Threads to make Java application faster by doing multiple things at same time. In technical terms, Thread helps you to achieve parallelism in Java program. Since CPU is very fast and nowadays it even contains multiple cores, ...

10 Examples of curl Command in UNIX and Linux

03/04/2017 20:48:00 PM

The curl is one of the essential commands to send HTTP requests from UNIX and Linux operating System. curl command is part of the cURL package and it's not just useful to send HTTP request but also allows you to transfer file using FTP and send ...

Difference between Executor, ExecutorService and Executers class in Java

02/28/2017 17:43:00 PM

All three classes Executor, ExecutorService, and Executers are part of Java's Executor framework which provides thread pool facilities to Java applications. Since creation and management of Threads are expensive and operating system also imposes ...

String Deduplication of G1 Garbage collector to Save Memory from Duplicate String in Java 8

02/25/2017 21:10:00 PM

You might not be aware that Java 8 update 20 has introduced a new feature called "String deduplication" which can be used to save memory from duplicate String object in Java application, which can improve the performance of your Java application ...

5 Differences between COALESCE and ISNULL in SQL Server

02/23/2017 19:39:00 PM

What is the difference between COALESCE and ISNULL is one of the frequently asked Microsoft SQL Server interview question. Recently, one of my reader asked the same question to me, he got confused between these two because both are used to replace ...

5 Difference between Constructor and Static Factory method in Java- Pros and Cons

02/22/2017 19:22:00 PM

The common way to create objects in Java is by using public constructors. A class provides public constructor e.g. java.lang.String so anyone can create an instance of String class to use in their application, but, there is another technique ...

Top 5 JavaScript Books to Learn - Best of Lot, Must Read

02/21/2017 19:08:00 PM

The JavaScript is the most popular programming language in Web, way ahead of popular ones like Perl, Ruby, and Python. It is also one of the essential skill for any Web developer. It is even true for Java developers. If you have JavaScript in ...

10 points about volatile modifier or field in Java

02/20/2017 19:12:00 PM

The volatile modifier has always been an interesting and tricky topic to many Java programmers. I still feel that it's one of the most underutilized modifiers in Java, which can do a lot of good if understood and applied correctly, after all, ...

Top 5 Core Java Books for Beginners - Learn Best of Lot

02/16/2017 20:52:00 PM

I have shared a lot of books related to Java and related technologies in the past e.g. Spring, Hibernate, JVM internals and performance tuning, multi-threading and concurrency, design patterns, data structure and algorithms etc, but I haven't ...

Top 6 SQL Query Interview Questions and Answers

02/15/2017 08:33:00 AM

The SQL, short form of Structured Query Language is one of the essential skills in today's programming world. No matter whether you are a Java developer, C++ developer or Python developer, you must know how to write SQL queries. Every programming ...

Top 5 Websites for Practicing Data structures and Algorithms for Coding Interviews Free

02/13/2017 19:06:00 PM

Are you preparing for Coding Interviews? If yes then you might know that there are a number of free online resources to practice important topics for coding Interviews e.g. data structure and algorithms, database and SQL, and others. These websites ...

How to Consume JSON from RESTful Web Service and Convert to Java Object - Spring RestTemplate Example

02/10/2017 20:39:00 PM

So far, I have not written much about REST and RESTful web service barring some interview questions e.g. REST vs SOAP, which is thankfully very much appreciated by my readers and some general suggestions about best books to learn REST in past, ...

17 Examples of Calendar and Date in Java

02/08/2017 21:27:00 PM

The java.util.Calendar class was added in Java on JDK 1.4 in an attempt to fix some flaws of the java.util.Date class. It did make some task simpler, e.g. create an arbitrary date comes easier using new GregorianCalendar(2016, Calendar.JUNE, ...

Top 10 Java wait, notify, Locking and Synchronization Interview Questions

02/06/2017 19:07:00 PM

There has been a lot of articles and books written on how to use wait and notify in Java, how they work, when do you need synchronization, and how to write concurrent code in Java, but, unfortunately, I still see many Java programmer struggles ...

Top 5 Books to learn REST and RESTful WebServices for Java Programmers

02/04/2017 20:49:00 PM

The REST has now become the standard way to develop web services. It's no more SOAP, who used to rule the world in last two decade. The SOAP and XML went very well together in past decade but it seems now REST and JSON have overtaken then and ...

Difference between JAX-RS, Restlet, Jersey, RESTEasy, and Apache CXF Frameworks

02/03/2017 07:03:00 AM

The JAX-RS is a Java specification request (JSR 311 & JSR 339) which standardize development and deployment of RESTful web services using Java and JEE technologies. It provides API in Java Programming language to create web services according ...

Where and How to download Spring Framework JAR file (Spring 4.0 or Spring 3.2) without Maven, Gradle

01/31/2017 18:40:00 PM

One of the easiest and oldest ways to run a Java program which depends on an external library or framework is to download dependency JAR files, put it on the classpath and then run the program by creating a Main class with the main() method. ...

Best Books to Learn Servlet and JSP

01/29/2017 22:25:00 PM

Unfortunately, there are not many good books to learn Servlet and JSP for Java web developers. Despite being the most popular Java Web technology, there are very few good books to learn Servlet and JSP. The one book, which everybody will suggest ...

Difference between for loop and Enhanced for loop in Java

01/29/2017 00:23:00 AM

Though you can use both for loop and enhanced for loop to iterate over arrays and collections like a list, set, or map. There are some key differences between them. In general, enhanced for loop is much more easy to use and less error prone ...

How to prepare for Java Interviews? Topics, Books, and Questions

01/26/2017 20:22:00 PM

Java Interviews are a little bit different than traditional programming interviews on tech giants and product based companies like Google, Amazon, Microsoft, or Facebook. First, even though it has questions from Data Structure and Algorithms ...

How to create LocalDateTime in Java 8 - Example

01/25/2017 09:00:00 AM

The LocalDateTime is a new class introduced in Java 8 new Date and Time API. This class is in java.time package and it represents both date and time information without timezone. In this example, you will learn different ways to create an instance ...

How to Split String based on delimiter in Java? Example Tutorial

01/23/2017 19:22:00 PM

You can use the split() method of String class from JDK to split a String based on a delimiter e.g. splitting a comma separated String on a comma, breaking a pipe delimited String on a pipe or splitting a pipe delimited String on a pipe. It's ...

Top 10 Excuses Programmers Gives to Avoid Unit Testing

01/22/2017 04:03:00 AM

Though everyone loves unit tests and everyone agree with benefits they bring in, when the time comes to write them, you will see a lot of excuses, even from some of the more experienced and senior developers. At the heart of the problem of not ...

How many characters is allowed on VARCHAR(n) columns in SQL Server? How much memory VARCHAR variable takes in disk?

01/21/2017 09:43:00 AM

One of the frequently ask SQL questions in any programming interviews is what is the difference between VARCHAR and CHAR data type in SQL? particularly when your project is using Microsoft SQL Server. You might have seen this couple of times, ...

Can we make an Array or ArrayList volatile in Java?

01/19/2017 19:22:00 PM

This is one of the many interesting multi-threading questions I have shared in my post 50 multi-threading interview questions. Yes, you can make an array volatile in Java, there is no problem with that, neither compiler will flag any error not ...

String replaceAll() example - How to replace all characters and substring from String

01/18/2017 19:20:00 PM

You can replace all occurrence of a single character, or a substring of a given String in Java using the replaceAll() method of java.lang.String class. This method also allows you to specify the target substring using the regular expression, ...

Top 10 UNIX and Linux System Programming Books- Best of Lot, Must Read

01/17/2017 19:25:00 PM

I have been sharing programming books in this blog from a long time, starting with core Java, I moved to other related technology e.g. Spring, Design patterns, Data Structure and Algorithms etc. Today, I am going to share some of the best UNIX ...

5 Free OCEJWCD 6 Mock Exam 1Z0-899 Practice Test

01/15/2017 19:42:00 PM

The OCEJWCD is the Oracle's version of SCWCD (Sun Certified Web Component Developer) exam, which tests candidate's knowledge on Servlet, JSP, and other web technology. The OCEJWCD stands for Oracle Certified Enterprise Java Web Component Developer. ...

Difference between PUT and POST in REST WebService in Java

10/24/2016 21:39:00 PM

If you remember REST WebServices uses HTTP methods to map CRUD (create, retrieve, update, delete) operations to HTTP requests. Even though both PUT and POST methods can be used to perform create and update operation in REST WebServices, Idempotency ...

How to enable SSL debugging in Java JVM?

10/23/2016 21:21:00 PM

Dealing with SSL issues in Java web application is no fun, especially when you have no debug logs and all you see is an ugly ‘Page Cannot be displayed’ error message in your browser. Thankfully you can easily enable SSL to debug on your ...

Restlet HelloWorld Example in Java and Eclipse

10/22/2016 23:38:00 PM

The Restlet is one of the first open source frameworks to create and deploy RESTful web service in Java. After the release of JAX-RS (Java API for RESTful Web Services) JSR - 317, Restlet also supports JAX-RS annotation and provides a consistent ...

How to get the last modified date and time of a file or directory in Java

10/22/2016 01:49:00 AM

Sometimes before processing a file, you want to check it's last modified date to avoid processing an old file. Though some programmers prefer to attach date in the file name itself, I don't find it a cleaner approach. For example, suppose ...

Difference between GETDATE() vs SYSDATETIME() vs GETUTCDATE() in SQL Server

10/20/2016 22:31:00 PM

One of the common question on Microsoft SQL Server interview is, what is the difference between GETDATE(), SYSDATETIME(), and GETUTCDATE(). Even though all three SQL Sever function returns the current date time in SQL Server, there are some ...

Top 2 Books for OCPJP8 Certification - Java 8 1Z0-809, 810, 813 Exam

10/19/2016 22:55:00 PM

This is the second part of best books for Java 8 certifications. Since you need to pass two exams, OCAJP8 and OCPJP8 to become a Java SE 8 certified developer, I have shared some of the best OCAJP8 books in the last article. In this article, ...

2 Ways to find Tomcat and Java Version in Linux and Windows

10/18/2016 23:22:00 PM

You can find Tomcat and java version running on Linux either by executing the org.apache.catalina.util.ServerInfo class from catalina.jar or by executing version.sh shell script. The first solution will work on any operating system including ...

How to replace a substring in Java?

10/17/2016 22:46:00 PM

You can replace a substring using replace() method in Java. The String class provides the overloaded version of the replace() method, but you need to use the replace(CharSequence target, CharSequence replacement). This version of the replace() ...

Base64 Encoding Decoding Example in Java 8

10/16/2016 21:56:00 PM

Until Java 8, there was no standard way to Base64 encode a String in Java or decode a base64 encoded String. Java Programmers either use Apache Commons library and it's Base64 class to encode or decode binary data into base 64 encoding, ...

Java Program to print pyramid pattern of stars and numbers

10/15/2016 22:29:00 PM

You can print Pyramid pattern of stars or numbers using loops and print methods in Java. There are two print method you need to know, System.out.print() and System.out.println(), the difference between print() and println() is that println adds ...

Difference between mvn install, release and deploy in Maven

10/14/2016 21:55:00 PM

Even though there are a couple of powerful build and deployment tools exists for Java applications e.g. Gradle or ANT, It seems Maven is the king of them. I have used in several Java projects over the years and it was initially ANT, but now ...

Best books to Learn Java 8

10/13/2016 22:15:00 PM

I often receive emails and queries asking about some good books to learn Java 8. Since Java 8 is very different from any other JDK release, in terms of language and API enhancement you really need a good book to learn fundamentals. In short, ...

How to check if String contains another SubString in Java? contains() and indexOf() example

10/13/2016 10:15:00 AM

You can use contains(), indexOf() and lastIndexOf() method to check if one String contains another String in Java or not. If a String contains another String then it's known as a substring. The indexOf() method accept a String and return ...

How to find square root of a number in Java - Algorithm Interview question

10/12/2016 01:57:00 AM

Write a program to calculate the square root of a number in Java or C++ is one of the popular coding interview questions from Programming job interviews both on tech companies like Facebook, Amazon, and investment banks like Citibank and Bank ...

How to check if a String is numeric in Java? Use isNumeric() or isNumber()

10/10/2016 21:43:00 PM

In day-to-day programming, you often need to check if a given String  is numeric or not. It's also a good interview question but that's a separate topic of discussion. Even though you can use a Regular expression to check if given String ...

How to check if ResultSet is empty in JDBC - Java Example

10/09/2016 21:00:00 PM

The JDBC ResultSet doesn't provide any isEmpty(), length() or size() method to check if its empty or not. Hence, when a Java programmer needs to determine if ResultSet is empty or not, it just calls the next() method and if next() return ...

Post Order binary tree traversal in Java - Recursion and Iteration

10/08/2016 23:27:00 PM

This is the third article on tree traversal. In the last couple of articles, I have shown you how to implement preorder and inorder traversal in Java, both recursively and iteratively and today, you will learn about the post order traversal. ...

How to split String in Java by WhiteSpace or tabs? Example Tutorial

10/07/2016 21:47:00 PM

You can split a String by whitespaces or tabs in Java by using the split() method of java.lang.String class. This method accepts a regular expression and you can pass a regex matching with whitespace to split the String where words are separated ...

How to increase heap size of Eclipse - Solving OutOfMemoryError

10/06/2016 20:57:00 PM

If you are running lots of Java projects in Eclipse and it's throwing OutOfMemoryError every now and then it's time to increase the heap memory of Eclipse. Since Eclipse is a Java program, you can increase heap size of Eclipse by using ...

How to convert java.util.Date to java.time.LocalDate in Java 8 - Example

10/05/2016 20:44:00 PM

The easiest way to convert a java.util.Date to java.time.LocalDate is via Instant, which is the equivalent class of java.util.Date in JDK 8. You can first convert util Date to Instant and then create a LocalDateTime object from that instant ...

How to Compare Date in SQL Server Query? Finding All Rows Between Two Dates

10/04/2016 20:59:00 PM

It's tricky to use dates in SQL server query, especially if you don't have good knowledge of how DateTime type works in SQL server. For example, one of the frequently asked SQL queries on the interview is to "select all rows where the ...

How to check if two Rectangle Overlap in Java - Algorithm

10/03/2016 21:12:00 PM

Can you write a Java program to check if two rectangles are overlapping with each other or not? is one of the frequently asked coding questions on tech giants like Facebook, Amazon, Microsoft and others. This is also a kind of problem where ...

3 ways to get number of months and year between two dates in Java?

10/02/2016 20:52:00 PM

Earlier I have talked about how to calculate a number of days between two dates in Java (see here), and now you will learn how to get the number of months and years between dates. Though it may look easy, it's not that easy to calculate ...