Few Basic Things About Java That Beginners Should Know

Java is an interesting and popular programming language but often the beginners do not understand the basic syntax and hence give up the idea of progressing any further with the study. Here is a guide for the beginners to understand the basic syntax in Java.

Object – Anything which has different states and behavior can be classified into Object. For instance, a cat will have states such as breed, color as well as behavior like pouncing, eating and so on.

Class – It is nothing but the template that talks about the behavior and state supported by the objects belonging to that class.

Methods – There can be several methods in a class wherein the programmer can write the logics, manipulate the data and implement an action.

Instance Variables – Every object has its unique set of instance variables. Also, the state of the object is created through values assigned to these instance variables.

Before starting with the first Java program, there are few things that should be considered.

Case Sensitivity – Same word types in uppercase and lowercase will mean different in Java.

Class Names – When defining the class name, the first letter should be in Uppercase. In case there are several words, each inner word should be in Uppercase.

Method Names – Unlike Class Names, all Method Names should start with the Lower Case letter. However, if there are several words used to form the Method Name, then every inner word’s first letter should be in Upper Case.

Program File Name – Program File and Class Name should match exactly

Public Static Void Main – The Program processing in Java starts from the main () which becomes the obligatory part of every Java Program.

Java Identifiers

There are several things to consider about the Identifiers such as:

All identifiers should start with a letter, underscore, and currency character

Post first character, identifiers can have several other combinations of characters

One cannot use a keyword as an Identifier

There are legal and illegal Identifiers

Identifiers are case sensitive

Java Modifiers – There are several ways to modify methods, classes with the help of modifiers in Java.

Java Variables – There are three types of variables in Java

  • Local Variables
  • Class Variables
  • Instance Variables

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recommended for you
Connect With Us
Stay Connected
Subscribe to our newsletter today to receive updates on latest tech news, tutorials SEO tips many more.
Latest Articles