Java

This page contains basic beginner and more advanced Java snippets; the purpose of this page is for those who are learning and like to learn via pure code as well as a location for mpettersson to keep snippets and Java related links. This pages subsections are:
 
Java 101
Miscellaneous Java Code
Java Resources
 
As always, please contact us with comments, concerns, questions, etc. about Java!
 
 

Java 101

For the complete set of Java development tools, such as the Java compiler, download the JDK from the Standard Edition (SE) Java download page. For the Java SE documentation, such as tutorials, visit Oracle’s documentation page. For an Integrated Development Environment (IDE) checkout Eclipse or NetBeans.
 

Keywords
abstract assert boolean break byte case
catch char class const continue default
do double else enum extends final
finally float for goto if implements
import instanceof int interface long native
new package private protected public return
short static strictfp super switch synchronized
this throw throws transient try void
volatile while

 
The first snippet, Java101.java, is complete Java source file which demonstrates the Java basics.
 

 
Use javac to compile java source (i.e., “javac Java101.java”) and java to run compiled source (i.e., “java Java101”). The next snippet contains commonly used basic calls.
 

 
 

Miscellaneous Java Code

This section contains random Java snippets and source code.
 

 

 
The next snippet is a simple program to replace specified text in a file with some other specified text.
 

 
 

Java Resources

Java Interview Questions and Answers – List of must-know (Java) concepts, rules, and principles.
Programming Methodology – A Stanford Java-based course on the fundamentals of programming.
ExpectIt – Yet another expect for Java.
log4j – Java-based logging utility.
TestNG – A testing framework inspired from JUnit and NUnit, but wait, there’s more…
JUnit – A framework to write repeatable tests, an instance of the xUnit architecture.
JUnit Cookbook – A cookbook for writing and organizing tests using JUnit.
JSch – A pure Java implementation of SSH2.
Apache Commons Codec – Encoders and decoders; such as Base64, Hex, Phonetic and URLs.
 
 
 

Leave a Reply