Java Variables

Java Variables

What is a variable? Variable is the name of the memory location from which we store the value. This is clear in the above example. A name that holds value. We can use variables to represent data. Representing attributes by variables. An attribute of an object can be referred to by a variable name that … Read more

Break Statement in Java

Break Statement in Java

A break statement is one of the branching statements(break, continue) provided by Java, which is also used to control the flow of the program. A break statement is used to exit (stop, terminate)from a running loop program on a condition that is predefined, before the loop completion(condition). By using break, you can force immediate termination(stop … Read more

Compound Assignment Operators in Java

Compound Assignment Operators in Java

The compound assignment operator(+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=,>>>=) is a combination of the assignment operator and another operator such as an arithmetic operator. So they are also known as Shorthand assignment operators. Syntax:   Variable operator variable or constant The following Table shows the compound assignment operators and their usage Operator                    Expression(shorthand)                   meaning +=                             vall+=increasee;                            vall=vall+increasee; -=                             firstt-=25;                                          firstt=firstt-25; … Read more

Factorial Program in Java

Factorial Program in Java

Factorial number definition: Factorial of n number is the product(*) of all positive integer(1*2*3*4*5) Denoted : 5! Means 5*4*3*3*1=120 here 51 means 5 factorial 3! Means 3*2*1=6 here 3! Means 3 factorial It is very interesting to note that the program with one type of loop can be converted to another program While, a do-while, … Read more

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

Call by Value and Call by Reference in C

Call by Value and Call by Reference in C

Argument passing (change(a,b), change(x,y))is a technique for transferring data and information between the calling and called function. There are two ways to pass arguments to the called function: a)Call by Value b)Call by reference. Call by Value: The call by value method is the default technique for passing arguments. In this method only the copies … Read more