Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Scope and parameters

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts

    Default Scope and parameters

    I really need someones help with the following 2 ques, 1) the line numbers were variable scope is visible and 2) name the actual and formal parameters in the program below.

    1 public class Scope {
    2 public static void test(int num) {
    3 if (num > 10) {
    4 int half = num / 2;
    5 System.out.println(“Half num = “ + half);
    6 } else {
    7 System.out.println(num);
    8 }
    9 }

    10 public static void main(String[] args)
    11 {
    12 int x = 5;
    13 test(x);
    14 }
    15 }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,273 Times in 2,244 Posts

    Default Re: Scope and parameters

    Is this the same question again? Please only post a question once.
    HELP Scope and Parameters in a program

    Please use the other thread.

    You need to respond to the last post on the other thread.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. HELP Scope and Parameters in a program
    By irishkid in forum What's Wrong With My Code?
    Replies: 7
    Last Post: December 7th, 2012, 04:29 PM
  2. [SOLVED] Out of scope problem
    By lf2killer in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 21st, 2012, 03:28 AM
  3. Problem with scope, please help!
    By austin.rose94 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 14th, 2011, 11:11 AM
  4. Scope problem
    By TP-Oreilly in forum What's Wrong With My Code?
    Replies: 5
    Last Post: December 9th, 2011, 07:41 AM
  5. variabe not within scope
    By brainwave in forum Java Servlet
    Replies: 0
    Last Post: April 17th, 2010, 05:51 AM