Posts Tagged ‘Java’

Loading Java Properties Files

Loading Java Properties Files
Java Properties files are amazing resources to add information in Java. Generally these files are used to store static information in key and value pair. Things that you do not want to hard code in your Java code goes into properties files.Although there are multiple ways of loading properties file, I will be focusing on loading the resource bundle files from class path resources. ...

Inner classes in Java, the mystery within.

Inner classes in Java, the mystery within.
Inner classes, also called Nested Classes, are nothing but classes that are defined within other classes. The nesting is a relationship between classes, not objects.Inner classes have clearly two benefits, name control & access control. In Java, this benefit is not as important because Java packages give the name control.Java inner classes have feature that ...

Null-safe Type in Java 7: New way to handle NullPointerException

Update: This feature has been removed from the final feature list that is being included in Java 7. Thanks @Stephen and @Stefan for the comments. Please refer to Project Coin for more details.NullPoniterException is one of the most common exception encountered in Java programming. When I searched "NullPointerException" in Google, it gave about ...

Java is Everywhere!

Watch this ad. Really, Technology changes the way we live our lives.
Tags:

Sending Emails in Java using GMail ID

Thought of sharing following code with you all. It is a small code snippet that uses SMTP in Java to login into GMail and send email using ones GMail account.String host = "smtp.gmail.com"; String from = "username"; String pass = "password"; Properties props = System.getProperties(); props.put("mail.smtp.starttls.enable", "true"); // added this line ...

Protect Java code from decompilation using Java Obfuscator

Protect Java code from decompilation using Java Obfuscator
If you are writing Java classes and distributing them over the Internet, you should know that people can reverse-engineer, disassemble, or decompile your classes into Java source code. One of such decompiler is JAD. In this article we discuss about the usage of JAD to decompile the Java class.So to make the job ...

20 very useful Eclipse IDE Shortcuts for Developers

20 very useful Eclipse IDE Shortcuts for Developers
Eclipse have been my favorite Java IDE since I started coding in Java. Shortcuts makes life very easy when you are working with any IDE. Eclipse also comes with lot of shortcuts that makes like of a developer easy.Following are few shortcuts of my choice.Ctrl + Shift + O : Organize imports Ctrl + / : ...

Static Import in Java: New way to Import things in Java!

Static Import is a new feature added in Java 5 specification. Java 5 has been around the corner for some time now, still lot of people who are new in Java world doesn't know about this feature.Although I have not used this feature in my work, still it is interesting to know about.What is ...

Dynamic Class Loading using Java Reflection API

Dynamic Class Loading using Java Reflection API
One of the reason why Java language has been so useful and used widely is the set of APIs that comes with the language (and 3rd party APIs like iText etc). Using these APIs one do a whole lot unimaginable stuff.Java Reflection API are one of such APIs that extend the horizon of a Java ...

Convert ArrayList to Arrays in Java

A lot of time I have to convert ArrayList to Arrays in my Java program. Although this is a simple task, many people don't know how to do this and end up in iterating the java.util.ArrayList to convert it into arrays. I saw such code in one of my friends work and I thought to share this so that people don't end up writing easy ...
Page 4 of 8« First...23456...Last »