usingMethods - // 10 System.out.println("in...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class usingMethods { public static void main(String[] args) { int num; int i; i = 10; num = 6; procedure(num); System.out.println("num in main: " + num); double a, b; a = 10; b = 5; i = 1; a = function(8, b); System.out.println("in main after function a is: " + a); // 20 System.out.println("in main after function b is: " + b); // 5 System.out.println("in main after function i is: " + i); // 1 a = 10; b = 5; i = 1; b = function(i, a); System.out.println("in main after function a is: " + a);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // 10 System.out.println("in main after function b is: " + b); // 32 System.out.println("in main after function i is: " + i); // 1 } public static double function(int i, double a) { int b = i; i = a * 2; a = 32; return a; } public static void procedure(int num) { // num = i; compiler error - i out of scope num = 10; System.out.println("num in procedure: " + num); } }...
View Full Document

Ask a homework question - tutors are online