Java Command Line Arguments

Java Command Line Arguments

Command line arguments are parameters that are supplied to the application program at the time of invoking it for execution. The arguments which are passed onto main() are Command line arguments. Use of Command Line Arguments in Java class  command { public static void main(String aa[]) { int cc, ii=0; String stri; cc=aa.length; System.out.println(“Number of … Read more

Stream in Java

A stream is a water body that carries water as it flows from one point(source) to another(destination). In programming terminology, a stream can be a continuous group of data or a channel through which data travels from one point(source) to another(destination). An input stream receives data from a source into a program and an output … Read more

How to Write Your First Java Program with Example

How to Write Your First Java Program with Example

Simple Program of Java Language import java.io.*;class welcome{public static void main(String aa[]){System.out.println(“Welcome in Java programming language”);System.out.println(“Java is developed by James Gosling”);System.out.println(“This language was initially called as Oak”);}} How to run Java Program Compile and execute : 2. Save this file as welcome.java in the bin folder using the jdk1.6.0 version. 3. Write these commands on … Read more

Java Applet Program to Add Two Numbers

Java Applet Program to Add Two Numbers

To build an applet, first of all, we need to create an applet code(program_name.java file). After successful compilation, its corresponding( program_name.class) file is created. Then a web page also known as an HTML document(  ) is to be developed. Once the HTML document(.html) is created, the applet is to be inserted into it. Finally, the … Read more

Armstrong Number in Java

Armstrong Number in Java

Program to Check Armstrong Number Armstrong number is that number which is of three  integer digits, which sum of the cube of its individual digits is equal to that number which we enter like 153, the cube of 1 and the cube of 5, and the cube of 3 and the sum of both (1*1*1)+(5*5*5)+(3*3*3)=153 … Read more

Draw a Chessboard in Java Applet

Draw a Chessboard in Java Applet

Java Program for Chess Game Each square(rectangle) in the chessboard is 20 pixels by 20 pixels. The squares are grey and black. If the row and column are either even or odd, then the color is Grey. Otherwise, change the color to Black. import java.awt.*; import java.applet.*; public class Checkerboarrd extends Applet {    public … Read more

Accessing Interface in Java

Accessing Interface in Java

The variables(int blue, int yellow, int pink) of an interface are always declared as final. Final variables are those variables, whose values are constants and can’t be modified(changed). The class that implements the interface will use the variables as declared within the interface and can’t modify( changed) the value of the variable. How to define … Read more

2D Array in Java

2D Array in Java

In Java, multidimensional arrays are also applied as arrays of arrays. 2D(two-dimension i.e tabular form) array is the generally used and simplest multi-dimensional array(like excel sheet(grids)). 2D arrays are represented in a row-columns([3][4]) form, and the terms “rows”[3]  and  “columns”[4] are used in computing. Syntax…. Declaration – Syntax:                Data_Type[][] Array_Name = new int[Row_Size][Cols_Size];       … Read more

Access Modifiers in Java

Access Modifiers in Java

ACCESS MODIFIERS……. Access modifier is a reserve key word  or we can say visibility controls which is used to restrict access.We can use these access modifier  to determine whether  a fields or methods in a class ,can be called or used by another class or sub class or not.That means these access modifiers can prevent … Read more