Saturday, 29 September 2012

C Introduction

Introduction TO C language:  

C Introduction
     C an programming language which is the base language of all the languages like c++, Java, PERL, Limbo, etc.

Dennis Ritchie Founder of C
C Introduction
C was firstly introduced and developed by Dennis Ritchie in 1969 at AT & T Bell Laboratory.


After the  C Introduction , the first Operating System is made using C language and known as UNIX.

UNIX is fully developed in C and known as the most secure Operating System.

After UNIX then Linux and Windows are developed using one and only C language.

All other languages uses the syntax and structure of C.

In short, C is the backbone of all other languages.

Wednesday, 12 September 2012

Java Tutorial Asignment

Java Tutorial AsignmentAsignment for java tutorial :-

Here am going to tell you about some java tutorial which you use most of the time.

You can take this as your asignment for java tutorial and which one writes the best, I'll publish that java tutorial on my blog.So just write the best java tutorial on the following topics:-





1. Write the java examples for printing output like this:-

                         *
                       *  *
                     *  *  *
                   *  *  *  *
2. Write the java examples for swaping two numbers without using a third variable.

3. Write the java examples for printing output like this:-

              1
          1  2  1
        1  2  2  1
      1  2  3  2  1

Monday, 10 September 2012

Adding two numbers using IInd Method(J2SE)

Adding two numbers
J2SE Programming

Now m going to write the program for adding two numbers using values via command line arguments.
Command-Line arguments are the arguments which are passed just before run time i.e. after compilation.
Now the problem is how to get the arguments via command line.
Command Line arguments are passed in the String array used in main function as an argument.
Now the numbers are passed as string and we want int then what to do for this.
We have a static method in Integer class i.e. parseInt(String) which takes an argument of type string an returns int and there is a condition that the string passed in this should have a valid int value otherwise there is an run time exception i.e. NumberFormatException.


Here is the program for this:-


                                       class abc                                        
                                       {
                                               int a,b,sum;

                                              public static void main(String[] args)
                                              {

                                                  a=Integer.parseInt(args[0]);      //Getting int from string array at position 0

                                                  b=Integer.parseInt(args[1]);     //Getting int from string array at position 1

                                                  sum=a+b;                               //Adding numbers

                                                  System.out.println("Sum = "+sum);            // Printing sum

                                             }
                                       }

Now how to pass value in that string array.
Here is the solution:-

Firstly compile it as usual using Javac program.java
Now Run using java program arg1 arg2
arg1 arg2 are the arguments which are the a and b.


For further queries, feel free to contact us any time using our contact us form.
Thank You.

Sunday, 29 July 2012

WAP to add two numbers by just assigning values(J2SE).

Adding two numbers
J2SE Programming

Now I am going to write a program which adds two numbers.
For this i just want to know about addition operator and two inputs.
As we know, there is one operator known as plus(+) operator can be used to add two inputs.
Now the problem is how to get input for adding numbers.

 There are three ways to get input as follows:-
  1. One way is just by assigning values.
  2. Second way is by User input during Run-time.
  3. Third way is using Command-Line arguments.
Here we are using First way i.e. by Assigning values.
Other ways will be discussed Later.

                               class Addition
                              {
                                          //Main Function
                                       public static void main(String[] args)
                                      {
                                          Addition a1=new Addition();
                                          int a=a1.add(10,20);
                                          System.out.println(Sum is : +a);
                                      }

                               //Function to add two numbers

                                       public int add(int a,int b)
                                      {

                                         int c=0;
                                         c=a+b;
                                         return c;

                                      }
                              }


Now save it as Addition.java
Compile it using "javac Addition.java" Command in CMD
After compilation Run it using command "java Addition" in CMD

Saturday, 28 July 2012

Printing Hello World In Java(J2SE)

J2SE Programming

Here now we go for our first program i.e. printing hello world in java.

class HelloWorld
{
        public static void main(String[] args)
        {
           System.out.println("Hello World");
        }
}

Now compile it as show in fig.
Firstly you have to move into the directory where the file is saved(use cd to move between Directories )


Print hello world in java

Once you have compiled it then Run it as Shown in fig below

Print hello world in java