Java primitive pass-by-value

public static void main(String[] args) { int x = 1; int y = 2; System.out.print("Values of x & y before primitive modification: "); System.out.println(" x = " + x + " ; y = " + y ); modifyPrimitiveTypes(x,y); System.out.print("Values of x & y after primitive modification: "); System.out.println(" x = " + x + " ; y = " + y ); } private static void modifyPrimitiveTypes(int x, int y) { x = 5; y = 10; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.