Friday, 30 October 2015

Interchange two value without third variable

Interchange two values without third variable
  • Make new jFrame and add the components to frame like given in below figure.
  • Open source code and declear three variables a,b,c as integer and also type the code of text fields.
  • Type the code given below 
  • Now I will explain how java interchanges the value:

  1. Let a=10,b=20.
  2. Here a=a+b means a=10+20=30.
  3. Now value of a=30.
  4. Then b=a-b means b=30-20=10.
  5. Then a=a-b means a=30-10=20.
  6. So by this java interchanges the value.
  • Now print a & b.
  • Run the file and see what happens.

Thursday, 29 October 2015

Interchange two values with third variable

Interchange two values with third variable
  • Make new jFrame and add the components to frame like given in below figure.



  • Open source code and declear three variables a,b,c as integer and also type the code of text fields.
  • Type the code given below 
  • Now I will explain how java interchanges the value:
  1. Let a=10,b=20,c=0.
  2. Here c=a means c=10.
  3. Now a=0.
  4. Then a=b means a=20.
  5. Now b=0.
  6. Then b=c means b=10.
  7. So by this java interchanges the value.
  • Now print a & b.
  • Run the file and see what happens.

Wednesday, 28 October 2015

Division java programming

Division java programming


  • Open netbeans and open new frame.
  • Put the components from pallet to jFrame as given below


    • Open source code window by double clicking on button.
    • Write the code as given below


    • Open source code window by double clicking on button.
    • Write the code as given below
    • Handling with numbers we us either short as short or long as long or integer as it.
    • We have use int.
    • Integer.parseInt is a code us for coding a number.
    • a and b at variables use to type number while c is used to store the the value of a and b and also to show result.
    • / sign is use between a and b for the division.
    • After completing it ,run the program and see what happens

    Tuesday, 27 October 2015

    Multiplication java programming

    Multiplication java programming


  • Open netbeans and open new frame.
  • Put the components from pallet to jFrame as given below

    • Open source code window by double clicking on button.
    • Write the code as given below

    • Handling with numbers we us either short as short or long as long or integer as it.
    • We have use int.
    • Integer.parseInt is a code us for coding a number.
    • a and b at variables use to type number while c is used to store the the value of a and b and also to show result.
    • * sign is use between a and b for the multiplication.
    • After completing it ,run the program and see what happens.

    Subtraction java programming

    Subtraction java programming


  • Open netbeans and open new frame.
  • Put the components from pallet to jFrame as given below

    • Open source code window by double clicking on button.
    • Write the code as given below
    • Handling with numbers we us either short as short or long as long or integer as it.
    • We have use int.
    • Integer.parseInt is a code us for coding a number.
    • a and b at variables use to type number while c is used to store the the value of a and b and also to show result.
    • - sign is use between a and b for the subtraction.
    • After completing it ,run the program and see what happens.

    Monday, 26 October 2015

    Addition java programming

    Addition java programming


  • Open netbeans and open new frame.
  • Put the components from pallet to jFrame as given           below


    • Open source code window by double clicking on button.
    • Write the code as given below


    • Handling with numbers we us either short as short or long as long or integer as it.
    • We have use int.
    • Integer.parseInt is a code us for coding a number.
    • a and b at variables use to type number while c is used to store the the value of a and b and also to show result.
    • + sign is use between a and b for the addition.
    • After completing it ,run the program and see what happens.

    Sunday, 25 October 2015

    String type java programming

    String type java programing
    • Open netbeans and make new application with new name.
    • Right click on new application and select new frame.
    • Drop four jLabel,jTextField and jButton from pallet on frame.
    • Name these component as your wish.
    • Double click on jButton.
    • Source code editor will turn up.
    • Type the cooding given in the picture below.


    • Declear the variables.
    • Get text means to take text.
    • Set text means to provide text.
    Completing it right click on the window and click run file.


    • Type only on that text field which is related with get text.
    • Click on button and see what happens.