Byron Kiourtzoglou

About Byron Kiourtzoglou

Byron is a master software engineer working in the IT and Telecom domains. He is always fascinated by SOA, middleware services and mobile development. Byron is co-founder and Executive Editor at Java Code Geeks.

Java beginners Guide

First steps in Java programming.

For a introduction tutorial in Java please see the official help from SUN here
where, except of the core language, several technologies and APIs are
introduced. We propose to begin by reading the trails covering the
basics and continue with the rest of the tutorials.

We propose to :

  • Keep the code straightforward and easy to read
  • Split functionality in logical components (classes) that interconnect if necessary
  • Try to comply with code re-usability design patterns, where common functionality is implemented in a public accessed methods
  • Document your code, using Javadoc comments and/or simple comments
  • Use a logging framework (Apache log4j is widely deployed and used) to produce logs
  • Use a testing framework (JUnit is widely deployed and used) to test your code
  • If you code involves String manipulation (splitting, adding, scanning
    characters etc), use the StringBuilder class rather than the String
    class, the StringBuilder implementation is much faster
  • If your code involves lists or maps, the ArrayList and HashMap are the fastest
    implementations, nevertheless if you are using the contains(Object)
    method on a collection, then the HashSet is the fastest implementation
    introducing a O(1) cost.
  • Java 5 and later versions include a management console (jconsole). You can use it to monitor your application
  • If your code involves pattern matching, prefer to use the Pattern and
    Matcher classes, rather than the Pattern.matches(regex, input)
    convenience method. Compile the pattern and use the Matcher.find()
    method as described below, especially if you reuse the same pattern
    where you should compile the pattern only once.

Preferred method for patter matching:

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

  public static void main(String args[]) throws Exception {

    Pattern p = Pattern.compile("Java \\d");
    String candidate = "this is a Java test";
    Matcher m = p.matcher(candidate);

    System.out.println("result=" + m.find());
  }
}
Related Whitepaper:

Bulletproof Java Code: A Practical Strategy for Developing Functional, Reliable, and Secure Java Code

Use Java? If you do, you know that Java software can be used to drive application logic of Web services or Web applications. Perhaps you use it for desktop applications? Or, embedded devices? Whatever your use of Java code, functional errors are the enemy!

To combat this enemy, your team might already perform functional testing. Even so, you're taking significant risks if you have not yet implemented a comprehensive team-wide quality management strategy. Such a strategy alleviates reliability, security, and performance problems to ensure that your code is free of functionality errors.Read this article to learn about this simple four-step strategy that is proven to make Java code more reliable, more secure, and easier to maintain.

Get it Now!  

One Response to "Java beginners Guide"

  1. Hi, great post, I take it as a guide for my blog, Thanks a lot!!.

Leave a Reply


eight × = 56



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

15,153 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books