Securing Higher Grades Costing Your Pocket? Book Your Coursework Help at The Lowest Price Now!

  • +1-617-874-1011 (US)
  • +44-117-230-1145 (UK)
Online Customer Service

Java Basic concept Homework Help

Java Basic concept:

When we look into java program it is basically using the concept of class and object. So now we concentrate on the class, object and method.


A class is a user defined blueprint which contains the entire set of similar data and functions that the object possess.


An object contains of state and behaviour. In the real world we may see many objects like house, car, dog etc. the object of class is known as instance.


A method is a logical operation written by programmer. A class may have many method that is depends on the all the actions are executed.

First Java program:

Now we consider simple code that will print first program.


public class MyFirstProgram
/* My first program.
It will print “First Program” as the output
public static void main(String []args)
System.out.println("First Program"); // prints First program

Steps for save, compile and run the java program:

  • Using notepad type the code.
  • Save this file as MyFirstProgram.Java.
  • Using command prompt compile the program using following syntax “javac MyFirstProgram.Java”.
  • If there is no error using this syntax for run your program “java MyFirstProgram.Java”.
  • Now you can see your output as ‘First Program’.


C:\> javac
C:\> java MyFirstProgram
First Program

Key points must remember while creating your program

  • Class Name – first letter of class and inner word must be Uppercase.

Ex: class MyFirstProgram

  • Method Name - first letter of method must be lower case and inner word must be Uppercase.

Ex: public firstMethodname()

  • File Name – file name and class name must be same. If more than one class used for your program means the main class name you have to use. If it is not match the compiler will not compile it. It also case sensitive.

Ex: if 'MyFirstProgram' is the class name means then the file should be saved as ‘’

  • Main method () – Every program must have main method because the program execution start with main method.

Ex: public static void main(String []args)

o public: public means that we can call the method from outside the class.

o static: No need to create an object for static methods to run. It can run itself.

o void: It cannot return anything.

o main: It is the method name.

o String[] args: it is used for argument passing as a string to command line argument.


In java the name used for the methods, class and variables are known as identifiers.

Identifiers must start with a letter that is (A - Z or a – z),$,_(underscore).

It is case sensitive, keyword cannot be used.

Ex: name, $age, _name

Ex: 4age, #name ( wrong identifiers)

Tap to Chat
Get Instant Assignment Help
Tap to Chat
Get Instant Assignment Help