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

Wednesday, 22 June 2011

Java program using OR opeator


import java.util.*;
class usingor
{
public static void main (String arg[])
{
Scanner in = new Scanner (System.in);

int a,b;

System.out.print ("\n\t Enter value of a = ");
a=in.nextInt();

System.out.print ("\n\t Enter value of b = ");
b=in.nextInt();

if (a<=10 || a<b)
System.out.println ("\n\t a is less then b or 10 ");
if (b>=25 || b==a)
System.out.println ("\n\t b is greater than 25 or equal to a ");

}
}

Note:
          In the above program, after you entered values of variables, first statement will be executed 
  • If 'a' is less than or equal to 10 
          OR
  • 'a' is less than 'b'
          and second statement will be executed in this case
  • If 'b' is greater than or equal to 25
          OR
  • 'b' is equal to 'a'

    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)
       
        Share