Java Tutorials, Tips & Tricks

Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun Microsystems’ Java. It is platform independent.

Java 8 Lambda Expressions Tutorial with Examples

Java 8 Lambda Expressions Tutorial with Examples
Java is a first-class object-oriented language. With the exception of primitive data types, everything in Java is an object. Even an array is an Object. Every class creates instances that are objects. There is no way of defining just a function / method which stays in Java all by itself. There is no way of passing a method as argument or returning a method body ...
Tags: ,

Java 8 Default Methods Tutorial

Java 8 Default Methods Tutorial
Java 8 Default Method tutorial. Overview of Virtual extension method in Java 8. How to define default methods to interfaces in Java 8.
Tags: ,

How to get Eclipse current workspace path

How to get Eclipse current workspace path
Eclipse does not show current workspace path easily. In order to know current eclipse workspace path, follow these simple steps.

Java Locale List

Java Locale List
Here is a complete list of Locales in Java. This list is compiled using the mighty java.text.SimpleDateFormat class.The class SimpleDateFormat provides a method getAvailableLocales() which gives array of java.util.Locale objects. This is java locale list. We can iterate over this list and get all relevant information about these locales.By the way, the above tag cloud ...
Tags:

How to Access Cookies in JSP Expression Language

How to Access Cookies in JSP Expression Language
Below snippet is just for your reference. We can print a cookie value on JSP page using JSP Expression language.The standard syntax to access Http Cookie value in JSP is:${cookie.<cookie name>.value}So if you want to print value of cookie named "foo" on JSP page, you might wanna write something like:${cookie.foo.value}In previous tutorial How to access Cookies in Spring MVC, I used JSP expression ...
Tags: ,

Eclipse: Convert String Concat to StringBuilder

Eclipse: Convert String Concat to StringBuilder
Here is a simple yet effective trick for all Eclipse users. In Java we do lot of String concatenation using plain old "" + "". It is easy but not too effective. StringBuilder is always preferred if you have too many strings to concate.In below screencast, I convert concatenated strings to StringBuilder using eclipse Ctrl + 1 option....

HTML5 Server-Sent Events with Java Servlets example

HTML5 Server-Sent Events with Java Servlets example
Since the dawn of modern web applications, push notifications have gained significant traction in industry. Instead of pooling data from server it has now become common that server should notify client.Ajax is so pervasive these days it is almost seen on every web page we visit. This is all good if you want to refresh a ...

Oracle Java JDBC: Get Primary Key of Inserted record

Here is a small write-up which should help those who still write plain Java JDBC code. I know we have some wonderful persistence frameworks like Hibernate that make ones life comfortable but the reality is we still have to deal with plain old JDBC apis. If you are poor chap like me, below code should make your ...
Tags: ,

Java XPath Tutorial: How to Parse XML File using XPath in Java

XPath is a language for finding information in an XML file. You can say that XPath is (sort of) SQL for XML files. XPath is used to navigate through elements and attributes in an XML document. You can also use XPath to traverse through an XML file in Java.XPath comes with powerful expressions that can be used to parse an xml document and retrieve ...

Dynamic Property Loader using Java Dynamic Proxy pattern

While reading through Stackoverflow, I came up to this interesting question: Java Properties File binding to Java Interface. The idea is simple but quite helpful.Basically we create an interface like:interface LoginConstants extends Constants { @DefaultStringValue("Welcome to my super app") @Key("appDescription") String appDescription();@DefaultStringValue("Ok") @Key("okButtonLabel") String okButtonLabel(); }And whenever we want to use ...
Page 1 of 912345...Last »