DEV Community

yedukondalu
yedukondalu

Posted on

Learn 7 Basics of Java Programming to Start Coding Today

In this post, I will cover 7 basics of Java Programming to help you start coding in Java Today. Before going ahead, I would recommend you go through our blog on How to Learn Java from Scratch, which ensures you have a clear learning roadmap in your mind.

I probably don’t need to tell you that without mastering basics in Java or any programming language, you cannot do coding efficiently.

Whether you are a recent graduate who is looking to learn a major programming language like Java or an experienced programmer who wants to increase the potential for future career growth, having a solid knowledge of basic concepts of Java is must. Java is an easy programming language for one who has paid attention to the basics, however, it can be equally frustrating for one who tries to take the shortcut.

If any of the above points sounds familiar, I have a great news: There are 7 basics concepts of Java which can help you to start coding better right today. You can also find a list of Java online courses which will cover these basics concepts and their application in detail. Let’s get started with our discussion….

Learn 7 Basics of Java Programming to Start Coding Today.jpg

We will cover 7 Java Coding basics elements in the following manner:

Basic Program Syntax
Variables
Datatypes
Operators
Arrays
Loops
Conditional Statements

Let’s get started with the first basic. Let us consider a basic sample program in Java, “Hello World” program.

1) Basic Program Syntax:

public class MyfirstJavaProgram {

public static void main (String[] args)

{

System.out.println(“Hello World”);

}

}

Let’s see some basic syntax to write this program:

Case sensitivity: Java is case sensitive. Here upper case letters and lower case letters are treated completely different.
Class name: For all class names the first letter should be in Upper Case.  If several words are used in class name each inner word should start with upper case letter. For example, in the above program class name is MyFirstJavaProgram.
Method name: Each method name should start with a lower case letter. If more words are included in Method name, then each word should start with Upper case word. For example, method name: Public void myMethodName().
System.out.println(): It is used as a print statement. System is the class, out is the object PrintStream class, println() is the method of PrintStream class.

2) Variables: A variable is used to store the data value. These are associated with data types. There are different types of variables as discussed below:

Local variable: A variable is declared inside the body of the method is called as local variables.
Instance variable: A variable declared inside the class but outside the body of the method, is called instance variables.
Static variable: A variable which is declared as static is called static variable. A static variable cannot be local. It is not possible to create a single copy of the static variable and share among all the instances of the class. Memory allocation for static variable only once when the class is loaded in the memory.

Continue reading this article click Here: https://simpliv.wordpress.com/2019/07/09/learn-7-basics-of-java-programming-to-start-coding-today/

Top comments (0)