We have covered substantial ground in the last 49 lessons. These lessons are sufficient for learning basics of core Java even for beginners. Of course, we have not yet covered all the topics that a Java programmer must know. We will resume our onward journey from lesson #51 where we start covering topics such as collections, threads, annotations and generics. But before proceeding we will recap what we have covered to take maximum advantage of previous lessons.
Note that lessons on http://codingraptor.com are sequentially arranged. So, you can start from the first lesson and follow the next links the same way you would read a book.
Beginning Java from Scratch
If you are total newbie with no previous experience in programming and no previous exposure to Java, you should study the following lessons and preferably in order they are presented. If you are an experienced programmer coming from another language, you need to pay extra attention to setting up the environment part because Java’ s development environment has a very different requirements from other languages such as JavaScript.
- Beginning Java: History in Brief – The let there be light lesson. Explains history of Java. How Java became so popular. Why it is so easy to pick up Java and how anyone can learn Java.
- Features of Java and Buzzwords – Introduces you to distinguishing features of Java and the most frequently used jargon of the Java world. Sun Microsystems coined 11 buzzwords in a whitepaper and these 11 words have become the corner stone of Java’s marketing strategy.
- JVM, JRE, JDK and JIT – newbies may get overwhelmed by these three letter acronyms. But having a firm understanding of these four pillars of Java’s contained programming environment is essential.
- Inside JVM 101 – JVM is a complicated C/C++ program and uses a number of complicated data structures. This lesson describes the basics of JVM architecture and the different memory areas in Java. Knowing about the memory areas plays a crucial role in writing concurrent programs.
- Java’s Program Execution Model and WORA – Java is famous for its write once run anywhere paradigm. This lesson explains how Java program gets compiled and executed. The lesson explains how Java’s compilation and execution makes WORA possible.
Setting up Your Environment and Running Hello World!
Having looked at what Java is and how it compiles and runs, we next turn to setting up our development environment and running the most basic Java program –
- Set up your programming environment – describes how to install JDK, the enviroment variables that might be useful and how to avoid “It works on my machine” kind of bugs.
- Using Netbeans – describes the basics of Netbeans IDE for Java development
- Using Eclipse – describes the basics of Eclipse IDE for Java development
- Using Text Editors – Many a times you want to avoid the overhead of a bloated IDE. Plain programming editors can work great if you know how to harness their power.
- Write and Run Hello World! – understand what main method is and what it does. Run the most basic Java program
- Learn to run Java programs from command line – many Java ‘experts’ don’t know how to set classpath and run Java programs from a command line. Learn how to run Java programs from command lines such as Linux terminal, Windows Power Shell and Mac’s terminal.
Learn About Variables and Data Types
Variables are the essential building blocks of a program in almost every language. Java is no exception. Data types take a special significance because Java is a strongly typed language.
- Variables in Java – learn how to declare and use variables. This lesson teaches about the four types of variables in Java. These four types have different lifetimes and visibility and knowing about the liveliness of a variable is essential to accessing them properly.
- Primitive Data Types in Java – though Java is strictly object oriented, a few data types are not objects. These data types are some of the most essential data types and are used for representing things as basic as characters and numbers.
- Literals in Java – Literals are one of the under-rated features of core Java. Knowledge of literals is especially essential for understand Java strings.
- Reference Data Types – are all too common in Java. Knowing about reference data types is essential to understand the control flow of even simplest Java program.
Operators and Statements in Core Java
Operators, conditional statements and looping constructs form the backbone of any program. Java is no different in this regard. Java has fearlessly adapted and incorporated successful operators and conditional statements (such as the enhanced for loop) from other languages from time to time. Introducing a new looping construct in a mature programming language such as Java is a bold step and the richness of Java statements can be attributed to this audacity.
- Conditional Statements – decision making structures of Java. Must know even for writing most basic programs.
- Operators – allow you to manipulate data. Bread and butter of every program.
- Statements, expressions and code blocks – even a lot of experienced programmers are oblivious to power of code blocks and can’t differentiate between an expression and a statement. An understanding of statements, expressions and code blocks is essential to derive the lifespan of variables.
- while, do-while looping constructs – although not the most popular looping construct, while statement allows for looping in indeterminate situations. It is essential to know when and how to use the while and do-while loops.
- The for loop – a for loop is the most popular looping mechanism. Learn how to use for loop and its read-only variant.
Modifiers in Java
Java allows a range of access and non-access modifiers. The modifiers alter the meaning, lifespan, visibility or value of a variable. The following is comprehensive list of tutorials on modifiers in Java –
- Access modifiers in Java – learn about the four access modifiers, how to use them and their impact on visibility of variables
- Non Access Modifiers: static and strictfp – learn about the most popular non access modifier i.e. static and the most exotic non access modifier i.e. strictfp
- Non Access Modifiers: final and synchronized – learn about final means in Java and how to use synchronized in multithreaded programs.
- Non Access Modifiers: abstract, transient, native and volatile – learn about the rest of non access modifiers in Java
Packages and import Statement
Java uses packages both for runtime security and avoiding name clashes. The import statement is the enabler which makes packages work seamlessly.
- Packages – learn more about packages in Java
- The import statement
- Static import in Java
Passing Inputs to Java Programs
No program is an island! You invariably have to pass in inputs to it – either through file or through command line or through environment variables.
- Passing inputs to Java programs via command line
- Passing inputs to Java programs via environment variables and files
Arrays in Java: Most Discussed, Least Used
Arrays in Java are not particularly popular. The fixed size of the data structure coupled with availability of linked lists such as Vectors right from version 1.0 has lead to arrays falling out of favour. Nevertheless, arrays are a must know data structure.
- What is an array?
- Declaring, initializing and instantiating an array
- Multidimensional arrays in Java
- Manipulating individual elements of an array
- Iterating arrays
Strings in Java
String manipulation is pretty easy on the surface. But Java strings are special. Except for Java string no other data type has an operator overloaded for it. Further, there are two ways of declaring strings and string literals can be used as string objects. Given the popularity of Java strings and myriad of complications, we spend fair deal of time discussing strings –
- Introduction to Java Strings
- String Immutability in Java
- StringBuilder and StringBuffer
- Some noteworthy methods in String class
- The intern method
- Miscellaneous String methods
Exceptions in Java
Exceptions are Java’s object oriented constructs to represent unusual situations. Almost every serious Java program deals with exceptions. Therefore, it is essential to learn the types of exceptions, how to use them and what types of exceptions should you create and throw –
- An Introduction to Java Exceptions (and some humor ?
- Introducing try, catch and finally
- Control flow in nested try, catch and finally
- A recap of rules concerning exceptions
- try with resource
- Class hierarchy of exceptions
- The throw and throws keywords
- Creating custom exceptions
Varargs in Java
Varargs or variable arguments is a feature that was introduced in Java 5. It allows a method or constructor to have maximum one argument that encapsulates a variable number of arguments.
Those were the 49 lessons to get you up and running with Java.
We will now venture into covering more advanced features of core Java.