Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

swapping java primitives values

// Swapping values
team1 = "A";
team2 = "OSU";

String temp = team2; // team1 = "A", team2 = "OSU", temp = "OSU" 
team2 = team1;       // team1 = "A", team2 = "A", temp = "OSU" 
team1 = temp;        // team1 = "OSU", team2 = "A", temp = "OSU"
Source by codehs.com #
 
PREVIOUS NEXT
Tagged: #swapping #java #primitives #values
ADD COMMENT
Topic
Name
3+9 =