Pages

June 06, 2015

Java Keywords and Objects Explained - Newbie Version (Part 2)

If you missed the previous one, click here for Part 1.


class
an object, the basic for Java
a Java program can have an infinite number of classes, and each class can communicate with each other, achieving whatever it is you intend to.


static
a keyword to denote something is to be compiled/created first, before anything else
this keyword can be applied to a class, a method, and a variable. Static objects doesn't need to be instantiated, and can be called immediately.


interface
a template for a Java class
why did I call it a template? A Java interface contains only method signatures and variables. It can be implemented by a Java class, and the class must contain the functions' actual code/implementation.


abstract
a keyword to denote something special
according to Java official tutorials, an abstract class cannot be instantiated, and may or may not have abstract methods. An abstract method is declared without an implementation, again according to Java official tutorial.


final
a keyword to make something a constant
anything declared as final becomes a constant, which means it may not be changed anytime, anywhere. This is useful when specifying hours in a day, days in a week, or anything you don't want to accidentally change later.


Do correct me if anything is incorrect or imprecise.

Thank you and stay tuned for the next part.

No comments: