Results 1 to 3 of 3
  1. #1
    nakkim is offline Member
    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Default About objects being able to be used in other "Public Classes"

    So as long as the classes are "public" and if there are two public classes, I can use objects from one class to another class?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,614
    Rep Power
    5

    Default Re: About objects being able to be used in other "Public Classes"

    The classes don't have to be public, nor do the methods, depending on the desired scope. Public will certainly allow that, but you can have a public class with private methods. So you should check out the access modifiers and how they work in the Oracle tutorials in my signature.

    Regards,
    Jim
    Last edited by jim829; 02-11-2014 at 03:27 AM. Reason: typo
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: About objects being able to be used in other "Public Classes"

    Say you have an object, if you make a new instance of that object in another class, you will only be able to access that objects public methods, not the private.
    1000011 1100001 1101110 100000 1111001 1101111 1110101 100000 1110010 1100101 1100001 1100100 100000 1000010 1101001 1101110 1100001 1110010 1111001 111111

Similar Threads

  1. Help needed with "Variable is not public in component" error.
    By Humphrey Bogart in forum New To Java
    Replies: 3
    Last Post: 05-29-2013, 09:27 PM
  2. Replies: 0
    Last Post: 12-07-2012, 08:29 AM
  3. Replies: 3
    Last Post: 10-30-2012, 03:06 PM
  4. Replies: 1
    Last Post: 05-20-2009, 08:46 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •