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: method

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Thanked 0 Times in 0 Posts

    Default method

    public class Test
    int data=10;
    public static void main(String arg[])
    Test op=new Test();
    System.out.println(data); //10
    op.change(data); //10
    System.out.println(data); //10
    public void change( int x)
    x=x +10;

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: method

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly using code or highlight tags per the above link.

    Since you've marked the thread solved, I assume you figured it out. If not, please comply with the above and then describe what help you need, ask a question, etc.

    Be well!

Similar Threads

  1. Replies: 1
    Last Post: May 27th, 2014, 07:39 PM
  2. Replies: 2
    Last Post: May 27th, 2014, 12:36 PM
  3. Replies: 6
    Last Post: December 29th, 2013, 03:34 PM
  4. Replies: 1
    Last Post: January 23rd, 2013, 07:29 AM
  5. [SOLVED] How to create a Java generic method, similar to a C++ template method?
    By Sharmeen in forum Object Oriented Programming
    Replies: 3
    Last Post: October 18th, 2012, 02:33 AM

Tags for this Thread