Sunday, September 20, 2015

Java Compile & Run


A java program we write in any editor that save with .java extension which called java code. Then we Compile by writing JAVAC gudsoft.java . After successfully compiled it automatically created its Byte Code as Class file(.class). Then we Execute java program by Writing JAVA gudsoft. During its internally Java Virtual Machine print the output as coding to particular operating system. 

The above Image show to shortly Java Programming working functions.

A Simple program to java understanding

class Gudsoft
{
public static void main(String args[])
{
System.out.print("Welcome in Gudsoft Classes");
}
}

Compile:
JAVAC gudsoft.java

Execute:
JAVA gudsoft

Output:
Welcome in Gudsoft Classes

Thursday, September 3, 2015

Swap of Two Numbers

/*Program in C to Swap the value of two variables without using extra variable*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter two numbers");
scanf("%d%d",&a,&b);
printf("\nBefore Swap");
printf("\na=%d   b=%d",a,b);
a=a+b;
b=b-a;
a=b-a;
printf("\nAfter Swap");
printf("\na=%d   b=%d",a,b);
getch();
}

Output
Enter two numbers 3
5
Before Swap
a=3   b=5
After Swap
a=5   b=3