---
title: "Discussion on \"Swapping of two numbers\" | Hashnode"
description: "Discussion on \"Swapping of two numbers\". swapping two numbers by using a temporary variable\npublic class Swap {\n  public static void main(String[] args) {\n    int a=10,b=20;\n    System.out.println(\"Before swapping: a=\"+a+\",b=\"+b);\n    int temp = a;\n    a = b;\n    b=temp;\n    System.err.prin..."
url: "https://hashnode.com/posts/swapping-of-two-numbers/654fb528f0b786cf5eff4c6c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Swapping of two numbers](https://sirishachallagiri.hashnode.dev/swapping-of-two-numbers?utm_source=hashnode&utm_medium=feed)

swapping two numbers by using a temporary variable public class Swap { public static void main(String\[\] args) { int a=10,b=20; System.out.println("Before swapping: a="+a+",b="+b); int temp = a; a = b; b=temp; System.err.prin...

Nov 11, 2023 · 1 min read · sirishachallagiri.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#swap](https://hashnode.com/tag/swap)
-   [#coding](https://hashnode.com/tag/coding)
-   [#coding-journey](https://hashnode.com/tag/coding-journey)
-   [#codewithexplanation](https://hashnode.com/tag/codewithexplanation)

## Written by

[Sirisha Challagiri](https://hashnode.com/@Siri2316)

@Siri2316

  
[View profile](https://hashnode.com/@Siri2316)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
