Skip to main content

Posts

Showing posts with the label Java program

Java if-else ladder with a example program.

Introduction:-   Today we shall check about the if-else ladder it is simlar to the if-else statement only the difference is that we can combine a if statement with the else we should have a example program with the syntax and whole bunch of stuff . We also provide a download link in bellow . You are free to change the code and if you wish to share the modified code share with us in the comments. What is the Syntax of the if -else ladder or if -else if ?   Syntax:-    if(Condition){     Statement 1      Statement 2      Statement 3   ..............    } else if(condition){    Statement 1    Statement 2    Statement 3   ................. } else{     Statement 1     Statement 2    Statement 3   ................ }    How to write the java program code for the ladder ? Code Statement ...

To implement a simple java program Hello Java.

Introduction:-     Today we shall be writing a java program to see how the program is writen in java and the basic of java shall be discussed in this post here will will be writing and executing the program I will show you the output . All the steps will be shown simultaneously. Writing a hello java program. class hellojava{   public static void main(String[] args){      System.out.println("Hello Java");   } } Step 1: Copy the upper program in a notepad file and then save it as hellojava.java with changing the text file to all files. Note : That the file name should be save as the class name because java is case sensitive . Step 2: Fire up your cmd as Adminstrator and then change the path to the saved java file . (To change the path type in the cmd as cd <path to the java file> ) Step 3: To Compile the java program type in the command " javac hellojava.java ".By execting the upper command the javac create a bytec...