answersLogoWhite

0

Swapping of 2 numbers using java language?

Updated: 8/18/2019
User Avatar

Wiki User

14y ago

Best Answer

Use a temporary variable. Example (swap variables "a" and "b"): int a = 5; int b = 10; // Swap the variables int temp; temp = a; a = b; b = temp; System.out.println("a = " + a); System.out.println("b = " + b);

Use a temporary variable. Example (swap variables "a" and "b"): int a = 5; int b = 10; // Swap the variables int temp; temp = a; a = b; b = temp; System.out.println("a = " + a); System.out.println("b = " + b);

Use a temporary variable. Example (swap variables "a" and "b"): int a = 5; int b = 10; // Swap the variables int temp; temp = a; a = b; b = temp; System.out.println("a = " + a); System.out.println("b = " + b);

Use a temporary variable. Example (swap variables "a" and "b"): int a = 5; int b = 10; // Swap the variables int temp; temp = a; a = b; b = temp; System.out.println("a = " + a); System.out.println("b = " + b);

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Use a temporary variable. Example (swap variables "a" and "b"): int a = 5; int b = 10; // Swap the variables int temp; temp = a; a = b; b = temp; System.out.println("a = " + a); System.out.println("b = " + b);

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Swapping of 2 numbers using java language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is HashMap Java used for?

HashMap Java is used as a definition in Java software programming language. This version of Java is used to tag objects using hash numbers and therefore differentiate different items in different databases.


What are java applications?

Applications that are built using the Java language are termed as Java applications.


What is the areas of application of java?

Applications that are built using the Java language are termed as Java applications.


What has the author Joe Weber written?

Joe Weber has written: 'Using Java 1.2' -- subject(s): Java (Computer program language) 'Using Java 1.1' -- subject(s): Java (Computer program language)


How do you convert numbers into words using java?

Using toString() method


How do you send a data from source node to destination node using integer linear programming in java language?

java


How can random numbers be generated in Java?

Random numbers can be generated in Java using the "random" class. One needs a single "random" object to generate a series of random numbers as a unit.


What language is the RuneScape client written in?

Runescape runs using Java script.


What type of application you can develop in java technology?

You can create games, desktop applications and mobile applications using Java programming language.


Is the java is procedural language?

Java is an Object Oriented language not a procedural language


How is java both a programming language and a platform?

By using Navite Interface we write this type of code


Does Visual Java plus plus and Java Builder is different from the Java language?

Yes!Visual Java plus plus and Java Builder is different from the Java language?