A Trip to Objectville — Chapter 2

There are two places where the main() method is used in Java

  1. To test you real class
  2. To launch/start your Java application

Steps to analyze a question in Object Oriented Concepts.

  1. Identify what the object knows about itself — instance variables
  2. Identify what the object can do — methods

Things to Note:

  • To find a random number between 0 and 9 the following can be used,

int n = (int) (Math.random() * 10);

  • When an end-user system is not Java installed, the platform specific JVM could be packaged alongside the compiled program for execution.


Heap : Each time an object is created, it is saved (memory allocation)on the “Heap” (aka the Garbage-Collectible Heap), where the space allocated depends on the number and size of the instance variables of the object.

Static: Marking a method/variable as public and static makes it reachable from anywhere in the code (globally available).

final: Marking a method/variable as public, static and final makes a constant reachable from anywhere in the code (globally-available constant).

JAR file: .Jar file aka a Java Archive file is a package based on the pkzip format, where all the necessary application files could be bundled up together. A simple text file named as manifest is used to define where the main() lies inside the jar.

Other than that, not much on this chapter. Thanks for reading. Until next time! 👋🏽



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Upulie Handalage

Upulie Handalage

Everything in my point of view. Here for you to read on....