Search This Blog

UI/UX Design | Web Development | Mobile Application Development

Whether you need UI/ UX design, web development services, or mobile app development services, Qaabil Digitals will be more than happy to help you. We work with top software developers, designers, and project managers. We tailor our services to suit your exact needs. We closely look at your company, listen to your story, and bring about the best ideas and solutions that can help you drive solid results. We don’t just produce work that works. We produce work that matters. Get a quote now Or Talk to us

Tuesday, 14 June 2011

How can you compile and execute your java program


After you have installed java open your command prompt or simply click at start button and then click run.
A small window will be opened. Write cmd in the text/search box and press run button.

Once you have opened command prompt open the drive/partition in which you have saved your program.
For example i have save my program in "local disk d/my progs". Write "d:" in command prompt and press enter.

After this write the folder name (as in above paragraph d/my progs) and press enter. I will write it as "my progs" and then enter. Now, write your program name and press enter. Just like this:

javac salary.java

there "javac" is the command to compile your program and "salary.java" shows that the programs name is salary and it is a java file.

Finally your program is compiled and ready to execute. When your program will be compiled successfully a class file of the program will be created in the same folder as in your program. To execute your program just write the following command

java salary

and your program will be executed.

Note: 
        "salary" is the program name. You should write the name of your program.

Arithmatic operators and their uses


Operators
Use
+
Addition
-
Subtraction
*
Multiplication
/
Division
%
Modulus
++
Increment
--
Decrement
=
Assignment
+=
Addition assignment
-=
Subtraction assignment
*=
Multiplication assignment
/=
Division assignment
%=
Modulus assignment




    Monday, 13 June 2011

    Using different arithmatic assignment operators in java program


    class assignops
    {
    public static void main (String arg[])
    {
    int a=10,b=25,c=5,d=18,e=49;
    a+=10;
    b-=10;
    c*=10;
    d/=2;
    e%=7;
    System.out.println ("\n\t a = "+a);

    System.out.println ("\n\t b = "+b);
    System.out.println ("\n\t c = "+c);

    System.out.println ("\n\t d = "+d);
    System.out.println ("\n\t e = "+e);
    }
    }

    Note:
              After execution you will observe following five changes
    1. Value of 'a' is increased by 10
    2. Value of 'b' is decreased by 10
    3. Value of 'c' is 50 (due to multiplying by 10)
    4. Value of 'd' is 9 (because we are dividing 'c' by 2)
    5. Value of 'e' is 0 (because 7 divides 49 properly)
     

      Using psot/prefix decrement operator in java program


      class apdecrement
      {
      public static void main (String arg[])
      {
      int a=97,b=23;
      int c,d;
      c=--a;
      d=b--;
      System.out.println ("\n\t a = "+a);
      System.out.println ("\n\t b = "+b);
      System.out.println ("\n\t c = "+c);
      System.out.println ("\n\t d = "+d);
      }
      }


      Note:
                After executing this program you will see the decrement in the values of 'a' , 'b' and 'c' but value of 'd' will as it is. Just like post fix increment increases value after it is used, post fix decrement also do so but it decreases the value by 1 after it is used.
      Share