Private access

I have a abstract class Point with one field : xValue declared as private.
I defined a getXvalue() method
then I made a subclass of point with a new field yValue
my getXvalue() methaod looks as follows:
public double getXvalue() {
return this.xValue;
I get following error:
TwoDimPoint.java [28:1] xValue has private access in Point
return this.xValue;
^
1 error
Errors compiling.
please help
thx

So how can I guarantee that my xValue is safe against
against outside access and keep my Class hierarchy
abstract class Point{private xValue }
class D2Point extends Point{ private yValue}
class D3Point extends D2Point{ private zValue}
For exemple I want a to access the xValue from a D2Point
so I need to call super.getXvalue()
but it is abstract
How can I solve the Problem ?
should I make a fourth class which is th super class of all others
and declare Point as public?
thx

Similar Messages

  • Trying to access an object's field but it has private access ! !

    Dear People,
    I am trying to access the highestBid, a data member of the Bid class
    in an Auction program.
    If I try to set the highestBid:
    bicycle.setHighestBid(steveBicycleBid);
    The error message says:
    "TryAuction.java": Error #: 306 : method setHighestBid(stan_bluej_ch4p90.Bid) has private access in class stan_bluej_ch4p90.Lot at line 58, column 15
    IF I try to get the highest bid by saying:
    System.out.println("The highest bid for this item is " + bicycle.getHighestBid() );
    I get an object hex address as seen below instead of an integer value:
    The highest bid for this item is stan_bluej_ch4p90.Bid@f4a24a
    ^^^
    Below are the classes
    Thank you in advance
    stan
    package stan_bluej_ch4p90;
    //Purpose of project: To demonstrate collections of objects
    //Version: 2001.05.31
    //How to start this project:
    // Create an Auction object.
    // Enter a few lots via its enterLot method. Only String
    // descriptions of the lots are required.
    // Create one or more Person objects to represent bidders.
    // Show the lots and select one to bid for.
    // Get the required Lot onto the object bench.
    // Enter a bid for the lot, passing the Person who is
    // bidding to the bidFor method.
    public class TryAuction
    public static void main(String[] args)
    //create the auction
    Auction cityAuction = new Auction();
    //create the lots for sale
    Lot bicycle = new Lot(1,"bicycle");
    Lot lamp = new Lot(2, "lamp");
    Lot trailer = new Lot(3, "trailer");
    //enter the lots into the city Auction
    cityAuction.enterLot("A bicycle in so so condition");
    cityAuction.enterLot("A brand new lamp");
    cityAuction.enterLot("A trailer built in 2001");
    //show the lots
    System.out.println();
    System.out.println("The first lot for sale: " + bicycle.getDescription());
    System.out.println("The second lot for sale: " + lamp.getDescription());
    System.out.println("The third lot for sale: " + trailer.getDescription());
    //create the people who will bid for the lots
    Person Steve = new Person("Steve");
    Person Maria = new Person("Maria");
    //create the people's bids
    Bid mariaLampBid = new Bid(Maria, 460);
    Bid steveLampBid = new Bid(Steve, 510);
    //create the people's bids
    Bid mariaBicycleBid = new Bid(Maria, 1460);
    Bid steveBicycleBid = new Bid(Steve, 1510);
    //create the people's bids
    Bid steveTrailerBid = new Bid(Steve, 700510);
    Bid mariaTrailerBid = new Bid(Maria, 900460);
    //give the bids
    bicycle.bidFor(Maria,1460);
    bicycle.bidFor(Steve, 1510);
    //bicycle.setHighestBid(steveBicycleBid);
    System.out.println("The highest bid for this item is " + bicycle.getHighestBid() );
    lamp.bidFor(Maria,460);
    lamp.bidFor(Steve,510);
    trailer.bidFor(Steve, 700510);
    trailer.bidFor(Maria,900460);
    System.out.println(" \nMaria's bicycle bid is : " + mariaBicycleBid.getValue() );
    System.out.println("Steve's lamp bid is : " + steveBicycleBid.getValue() );
    System.out.println(" \nMaria's lamp bid is : " + mariaLampBid.getValue() );
    System.out.println("Steve's lamp bid is : " + steveLampBid.getValue() );
    System.out.println("\nSteve's trailer bid is : " + steveTrailerBid.getValue() );
    System.out.println(" Maria's trailer bid is : " + mariaTrailerBid.getValue() );
    System.out.println();
    cityAuction.showLots();
    //cityAuction.close();
    //The output I get is:
    //The first lot for sale: bicycle
    //The second lot for sale: lamp
    //The third lot for sale: trailer
    //The highest bid for this item is stan_bluej_ch4p90.Bid@f4a24a
    //Maria's bicycle bid is : 1460
    //Steve's lamp bid is : 1510
    //Maria's lamp bid is : 460
    //Steve's lamp bid is : 510
    //Steve's trailer bid is : 700510
    // Maria's trailer bid is : 900460
    //1: A bicycle in so so condition
    // (No bid)
    //2: A brand new lamp
    // (No bid)
    //3: A trailer built in 2001
    // (No bid)
    package stan_bluej_ch4p90;
    import java.util.*;
    //Ex4.14
    * A simple model of an auction.
    * The auction maintains a list of lots of arbitrary length.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.06.08
    public class Auction
    // The list of Lots in this auction.
    private ArrayList lots;
    // The number that will be given to the next lot entered
    // into this auction.
    private int nextLotNumber;
    * Create a new auction.
    public Auction()
         lots = new ArrayList();
         nextLotNumber = 1;
    * Enter a new lot into the auction.
    * Lots can only by entered into the auction by an
    * Auction object.
    * @param description A description of the lot.
    public void enterLot(String description)
         lots.add(new Lot(nextLotNumber, description));
         nextLotNumber++;
    * Show the full list of lot numbers and lot descriptions in
    * this auction. Include any details of the highest bids.
    public void showLots()
         Iterator it = lots.iterator();
         while(it.hasNext()) {
         Lot lot = (Lot) it.next();
         System.out.println(lot.getNumber() + ": " +
                   lot.getDescription());
         // Include any details of a highest bid.
         Bid highestBid = lot.getHighestBid();
         if(highestBid != null) {
              System.out.println(" Bid: " +
                        highestBid.getValue());
         else {
              System.out.println(" (No bid)");
    * Return the lot with the given number. Return null
    * if a lot with this number does not exist.
    * @param number The number of the lot to return.
    public Lot getLot(int number)
         if((number >= 1) && (number < nextLotNumber)) {
         // The number seems to be reasonable.
         Lot selectedLot = (Lot) lots.get(number-1);
         // Include a confidence check to be sure we have the
         // right lot.
         if(selectedLot.getNumber() != number) {
              System.out.println("Internal error: " +
                        "Wrong lot returned. " +
                        "Number: " + number);
         return selectedLot;
         else {
         System.out.println("Lot number: " + number + " does not exist.");
         return null;
    // public void close()
    // Iterator i = lots.iterator();
    // while(i.hasNext())
    //     System.out.println("The winning amount for the " + bicycle.getDescription()
    //     + " is " + bicycle.getHighestBid());
    //     System.out.println("The winning amount for the " + lamp.getDescription()
    //     + " is " + lamp.getHighestBid());
    //     System.out.println("The winning amount for the " + trailer.getDescription()
    //     + " is " + trailer.getHighestBid());
    package stan_bluej_ch4p90;
    * A class to model an item (or set of items) in an
    * auction: a lot.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.06.08
    public class Lot
    // A unique identifying number.
    private final int number;
    // A description of the lot.
    private String description;
    // The current highest bid for this lot.
    private Bid highestBid;
    * Construct a Lot, setting its number and description.
    * @param number The lot number.
    * @param description A description of this lot.
    public Lot(int number, String description)
         this.number = number;
         this.description = description;
    * Attempt to bid for this lot. A successful bid
    * must have a value higher than any existing bid.
    * @param bidder Who is bidding.
    * @param value The value of the bid.
    public void bidFor(Person bidder, long value)
         // We trust that lot is genuine. There is nothing to
         // prevent a spurious lot from being bid for, but it
         // would not appear in the auction list.
         if((highestBid == null) ||
         (highestBid.getValue() < value)) {
         // This bid is the best so far.
         setHighestBid(new Bid(bidder, value));
         else {
         System.out.println("\nLot number: " + getNumber() +
                   " (" + getDescription() + ")" +
                   " has a bid of: " +
                   highestBid.getValue());
    * @return The lot's number.
    public int getNumber()
         return number;
    * @return The lot's description.
    public String getDescription()
         return description;
    * @return The highest bid for this lot. This could be null if
    * there are no current bids.
    public Bid getHighestBid()
         return highestBid;
    * @param highestBid The new highest bid.
    private void setHighestBid(Bid highestBid)
         this.highestBid = highestBid;
    package stan_bluej_ch4p90;
    * A class that models an auction bid. The bid contains a reference
    * to the Lot bid for and the user making the bid.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.05.31
    public class Bid
    // The user making the bid.
    private final Person bidder;
    // The value of the bid. This could be a large number so
    // the long type has been used.
    private final long value;
    * Create a bid.
    * @param bidder Who is bidding for the lot.
    * @param value The value of the bid.
    public Bid(Person bidder, long value)
         this.bidder = bidder;
         this.value = value;
    * @return The bidder.
    public Person getBidder()
         return bidder;
    * @return The value of the bid.
    public long getValue()
         return value;
    package stan_bluej_ch4p90;
    * Maintain details of someone who participates in an auction.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.05.31
    public class Person
    // The name of this user.
    private final String name;
    * Create a new user with the given name.
    * @param name The user's name.
    public Person(String name)
         this.name = name;
    * @return The user's name.
    public String getName()
         return name;
    if I try to say
    LotObjectName.getHighestBid, I get a

    Dear EsoralTrebor,
    Thank you very much for an enlightening explanation.
    I had never tried to chain methods together before but it works !
    anObject.methodOfTheObjectClassThatReturnsAnObjectOfAnotherClass.
    methodOfTheObjectClassThatWasReturned();
    my output correctly states:
    The highest bid for the bicycle is 1510
    The highest bid for the lamp is 510
    The highest bid for the trailer is 900460
    Thank you !
    Stan
    ps tomorrow I need to study the showLots() method in the Auction class
    to figure out why that method is saying "No Bid" to everything
    Have a Good Thanksgiving !

  • Don't understand private access error message.

    I am calling createAndShowGui from another file and am getting an error message from the compiler that says:
    createAndShowGUI has private access in masterfilemaint.MasterFileMaint.
    I don't understand because the method is public. Here is the call.
    thanks.
        public void actionPerformed(ActionEvent e) {
            if ("Fil".equals(e.getActionCommand())) {   ///  The Call......
                   callItemMaint.createAndShowGUI();
                if ("Tab".equals(e.getActionCommand()))  {
                   callSimpleTableDemo.createAndShowGUI();   
                if ("Quit".equals(e.getActionCommand())) {
                   quit();
                /*else {
                  quit();
        }       ..............And here is the method.
           public void createAndShowGUI() {// was static
            // set decor
            JFrame.setDefaultLookAndFeelDecorated(true);
            // create/set-up window
            JFrame frame = new JFrame("Guide");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            // set up content pane.
            addComponentsToPane(frame.getContentPane());
            // Display window
            frame.pack();
            frame.setVisible(true);
    }

    Is the createAndShowGUI in a public class?
    Yes here is the first few lines of the class:
    package masterfilemaint;
    import java.awt.*;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    import javax.swing.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class MasterFileMaint {                //   Class is public .........
        final static boolean shouldFill = true;
        final static boolean shouldWeightX = true;
        final static boolean RIGHT_TO_LEFT = false;
        final static boolean DEBUG = false;
        public JTextField textFieldOne, textFieldTwo,
                             textFieldThree, textFieldFour, textFieldFive;
        public JLabel label;
        public JButton button;
        public String one, two, three, four, five, six;
        Is callItemMaint an instance of that class or an instance of a base class or interface?
    callitemMaint is an instance of MasterFileMaint instantiated in the calling class. Here is the first few lines of MaterFileMaint.
    package probuyermain;
    import CalculatorOne.*;
    import simpletabledemo.*;
    import masterfilemaint.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.JCheckBoxMenuItem;
    import javax.swing.JRadioButtonMenuItem;
    import javax.swing.ButtonGroup;
    import javax.swing.JMenuBar;
    import javax.swing.KeyStroke;
    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    public class ProBuyerMain implements ActionListener {
        JTextArea output;
        JScrollPane scrollPane;
        MasterFileMaint callItemMaint = new MasterFileMaint();        // The instance
        CalculatorOne callCalculator = new CalculatorOne();
        SimpleTableDemo callSimpleTableDemo = new SimpleTableDemo();
        public JMenuBar createMenuBar() {
            JMenuBar menuBar;
            JMenu fileMenu, submenu;
            JMenuItem menuItemOne, menuItemTwo,
                        menuItemThree, menuItemFour, menuItemFive;
            //Create the menu bar.
            menuBar = new JMenuBar();

  • Is the instance fields have private accessibility in String class?

    Is the instance fields have private accessibility in an immutable class, such as the String class?
    also Could any one answer the following question,
    (This is the question I got in written exam for job recruitment)
    "Invoking a method can represent a significant amount of overhead in a program; as such, some compilers will perform an optimization called "method inlining." This optimization will remove a method call by copying the code inside the method into the calling method."
    Referring to the text above, which one of these statements is true?
    Choice 1 The performance benefits should be balanced against the increased chance of a RuntimeException.
    Choice 2 It allows the use of getter and setter methods to execute nearly as fast as direct access to member variables.
    Choice 3 This optimization will only occur if the relevant methods are declared volatile.
    Choice 4 The developer of inlined methods must copy and paste the code that is to be inlined into another method.
    Choice 5 It prevents code from executing in a way that follows object-oriented encapsulation.

    Sarwan_Gres wrote:
    Is the instance fields have private accessibility in an immutable class, such as the String class?Usually, but not always.
    "Invoking a method can represent a significant amount of overhead in a program; as such, some compilers will perform an optimization called "method inlining." This optimization will remove a method call by copying the code inside the method into the calling method."The java compiler does not inline methods so this is not relevant to Java. (The JVM does inline methods) The java compiler does inline constants known at compile time but it is a feature causes more trouble than good IMHO.

  • EntrySet has private access in java.util.Hashtable

    Hi friends,
    While i try to retrieve the data from the hashtable through a JSP page, i'm getting the error saying "E:\Tomcat 5.0\work\Catalina\localhost\dd\org\apache\jsp\disp_jsp.java:55: entrySet has private access in java.util.Hashtable
    Iterator i = h.entrySet.iterator();
    For your reference the code goes like this,
    <% Hashtable h = (Hashtable) session.getAttribute("hash");
    Iterator i = h.entrySet.iterator();
    while(i.hasNext())
    %>
    <tr><td>
    <% String st = i.next().toString();
    String k[] = st.split("=");     
    out.println(k[0]); %>
    </td><td><%
    out.println(k[1]); %></td></tr><% } %>
    can anyone tell me how to get rid of this error quickly please.. Thanks in advance...
    Regards,
    Prakash.

    Iterator i = h.entrySet.iterator();Iterator i = h.entrySet().iterator();

  • HOW TO SET  VARIABLE WHEN METHOD HAS PRIVATE ACCESS ? ?

    Dear People,
    When I try to use an if then else statement the if part is not executed
    only the else
    if(highestBid != null)
    System.out.println( Bid is: + highestBid.getValue());
    else
    System.out.println(" (no bid) )";
    which can only mean that "highestBid is not being set
    but since "Class Lot" has a private method
    private void setHighestBid(Bid highestBid)
    this.highestBid = highestBid;
    the error message says:
    "TryAuction.java": Error method setHighestBid()
    has private access in class
    so how do I get a value to "highestBid" so the "if" statement
    will have a vaule for "highestBid ?
    the showLots() method in the Class "Auction" doesn't print out the bids !
    below are the classes
    thank you in advance
    Stan
    package stan_bluej_ch4p90;
    //Purpose of project: To demonstrate collections of objects
    //Version: 2001.05.31
    //How to start this project:
    // Create an Auction object.
    // Enter a few lots via its enterLot method. Only String
    // descriptions of the lots are required.
    // Create one or more Person objects to represent bidders.
    // Show the lots and select one to bid for.
    // Get the required Lot onto the object bench.
    // Enter a bid for the lot, passing the Person who is
    // bidding to the bidFor method.
    public class TryAuction
    public static void main(String[] args)
    //create the auction
    Auction cityAuction = new Auction();
    //create the lots for sale
    Lot bicycle = new Lot(1,"bicycle");
    Lot lamp = new Lot(2, "lamp");
    Lot trailer = new Lot(3, "trailer");
    //enter the lots into the city Auction
    cityAuction.enterLot("A bicycle in so so condition");
    cityAuction.enterLot("A brand new lamp");
    cityAuction.enterLot("A trailer built in 2001");
    //show the lots
    System.out.println();
    System.out.println("The first lot for sale: " + bicycle.getDescription());
    System.out.println("The second lot for sale: " + lamp.getDescription());
    System.out.println("The third lot for sale: " + trailer.getDescription());
    //create the people who will bid for the lots
    Person Steve = new Person("Steve");
    Person Maria = new Person("Maria");
    //create the people's bids
    Bid mariaLampBid = new Bid(Maria, 460);
    lamp.setHighestBid(mariaLampBid);
    Bid steveLampBid = new Bid(Steve, 510);
    //create the people's bids
    Bid mariaBicycleBid = new Bid(Maria, 1460);
    //bicycle.setHighestBid(mariaBicycleBid);
    Bid steveBicycleBid = new Bid(Steve, 1510);
    //create the people's bids
    Bid steveTrailerBid = new Bid(Steve, 700510);
    //trailer.setHighestBid(steveTrailerBid);
    Bid mariaTrailerBid = new Bid(Maria, 900460);
    //give the bids
    bicycle.bidFor(Maria,1460);
    bicycle.bidFor(Steve, 1510);
    System.out.println("The highest bid for the bicycle is " + bicycle.getHighestBid().getValue() );
    lamp.bidFor(Maria,460);
    lamp.bidFor(Steve,510);
    System.out.println("The highest bid for the lamp is " + lamp.getHighestBid().getValue() );
    trailer.bidFor(Steve, 700510);
    trailer.bidFor(Maria,900460);
    System.out.println("The highest bid for the trailer is " + trailer.getHighestBid().getValue() );
    System.out.println(" \nMaria's bicycle bid is : " + mariaBicycleBid.getValue() );
    System.out.println("Steve's bicycle bid is : " + steveBicycleBid.getValue() );
    System.out.println(" \nMaria's lamp bid is : " + mariaLampBid.getValue() );
    System.out.println("Steve's lamp bid is : " + steveLampBid.getValue() );
    System.out.println("\nSteve's trailer bid is : " + steveTrailerBid.getValue() );
    System.out.println(" Maria's trailer bid is : " + mariaTrailerBid.getValue() );
    System.out.println();
    cityAuction.showLots();
    //cityAuction.close();
    //The output I get is:
    //The first lot for sale: bicycle
    //The second lot for sale: lamp
    //The third lot for sale: trailer
    //The highest bid for this item is stan_bluej_ch4p90.Bid@f4a24a
    //Maria's bicycle bid is : 1460
    //Steve's lamp bid is : 1510
    //Maria's lamp bid is : 460
    //Steve's lamp bid is : 510
    //Steve's trailer bid is : 700510
    // Maria's trailer bid is : 900460
    //1: A bicycle in so so condition
    // (No bid)
    //2: A brand new lamp
    // (No bid)
    //3: A trailer built in 2001
    // (No bid)
    package stan_bluej_ch4p90;
    import java.util.*;
    //Ex4.14
    * A simple model of an auction.
    * The auction maintains a list of lots of arbitrary length.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.06.08
    public class Auction
    // The list of Lots in this auction.
    private ArrayList lots;
    // The number that will be given to the next lot entered
    // into this auction.
    private int nextLotNumber;
    * Create a new auction.
    public Auction()
         lots = new ArrayList();
         nextLotNumber = 1;
    * Enter a new lot into the auction.
    * Lots can only by entered into the auction by an
    * Auction object.
    * @param description A description of the lot.
    public void enterLot(String description)
         lots.add(new Lot(nextLotNumber, description));
         nextLotNumber++;
    * Show the full list of lot numbers and lot descriptions in
    * this auction. Include any details of the highest bids.
    public void showLots()
         Iterator it = lots.iterator();
         while(it.hasNext()) {
         Lot lot = (Lot) it.next();
         System.out.println(lot.getNumber() + ": " +
                   lot.getDescription());
         // Include any details of a highest bid.
         Bid highestBid = lot.getHighestBid();
         if(highestBid != null) {
              System.out.println(" Highest Bid: " +
                        highestBid.getValue());
         else {
              System.out.println(" (No bid)");
    * Return the lot with the given number. Return null
    * if a lot with this number does not exist.
    * @param number The number of the lot to return.
    public Lot getLot(int number)
         if((number >= 1) && (number < nextLotNumber)) {
         // The number seems to be reasonable.
         Lot selectedLot = (Lot) lots.get(number-1);
         // Include a confidence check to be sure we have the
         // right lot.
         if(selectedLot.getNumber() != number) {
              System.out.println("Internal error: " +
                        "Wrong lot returned. " +
                        "Number: " + number);
         return selectedLot;
         else {
         System.out.println("Lot number: " + number + " does not exist.");
         return null;
    // public void close()
    // Iterator i = lots.iterator();
    // while(i.hasNext())
    //     System.out.println("The winning amount for the " + bicycle.getDescription()
    //     + " is " + bicycle.getHighestBid());
    //     System.out.println("The winning amount for the " + lamp.getDescription()
    //     + " is " + lamp.getHighestBid());
    //     System.out.println("The winning amount for the " + trailer.getDescription()
    //     + " is " + trailer.getHighestBid());
    package stan_bluej_ch4p90;
    * A class that models an auction bid. The bid contains a reference
    * to the Lot bid for and the user making the bid.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.05.31
    public class Bid
    // The user making the bid.
    private final Person bidder;
    // The value of the bid. This could be a large number so
    // the long type has been used.
    private final long value;
    * Create a bid.
    * @param bidder Who is bidding for the lot.
    * @param value The value of the bid.
    public Bid(Person bidder, long value)
         this.bidder = bidder;
         this.value = value;
    * @return The bidder.
    public Person getBidder()
         return bidder;
    * @return The value of the bid.
    public long getValue()
         return value;
    package stan_bluej_ch4p90;
    * A class to model an item (or set of items) in an
    * auction: a lot.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.06.08
    public class Lot
    // A unique identifying number.
    private final int number;
    // A description of the lot.
    private String description;
    // The current highest bid for this lot.
    private Bid highestBid;
    * Construct a Lot, setting its number and description.
    * @param number The lot number.
    * @param description A description of this lot.
    public Lot(int number, String description)
         this.number = number;
         this.description = description;
    * Attempt to bid for this lot. A successful bid
    * must have a value higher than any existing bid.
    * @param bidder Who is bidding.
    * @param value The value of the bid.
    public void bidFor(Person bidder, long value)
         // We trust that lot is genuine. There is nothing to
         // prevent a spurious lot from being bid for, but it
         // would not appear in the auction list.
         if((highestBid == null) ||
         (highestBid.getValue() < value)) {
         // This bid is the best so far.
         setHighestBid(new Bid(bidder, value));
         else {
         System.out.println("\nLot number: " + getNumber() +
                   " (" + getDescription() + ")" +
                   " has a bid of: " +
                   highestBid.getValue());
    * @return The lot's number.
    public int getNumber()
         return number;
    * @return The lot's description.
    public String getDescription()
         return description;
    * @return The highest bid for this lot. This could be null if
    * there are no current bids.
    public Bid getHighestBid()
         return highestBid;
    * @param highestBid The new highest bid.
    private void setHighestBid(Bid highestBid)
         this.highestBid = highestBid;
    package stan_bluej_ch4p90;
    * Maintain details of someone who participates in an auction.
    * @author David J. Barnes and Michael Kolling.
    * @version 2001.05.31
    public class Person
    // The name of this user.
    private final String name;
    * Create a new user with the given name.
    * @param name The user's name.
    public Person(String name)
         this.name = name;
    * @return The user's name.
    public String getName()
         return name;

    Are you ready to kick yourself? The problem lies in the class Auction. You are using showLots() to print the lots, which you are trying to show the lot number, the description and the highest bid. But no there is no where in the class where you set the highest bid. In enterLot() you pass the description of the lot and it creates a new lot with the lot number and the description, but you don't give a bid. Then after the bids are done you do not update Auction to reflect the bids. Let the kicking commence. :-)

  • Has private access in mudclient

    Alright, i've been getting on this error on every int I try to pull from the mudclient:
    .\Script.java:19: dgf has private access in mudclient
                    rs.dfm[0] = rs.dgf[idx].gmi;
                                  ^
    .\Script.java:20: djk has private access in mudclient
                    rs.djk[0] = rs.dgf[idx].gmf;
                      ^
    .\Script.java:20: dgf has private access in mudclient
                    rs.djk[0] = rs.dgf[idx].gmf;
                                  ^
    .\Script.java:21: emg(int) has private access in mudclient
                    rs.emg(0);
    etc.here is what I have in script.java
    public void AN(int idx) {
    public abstract class Script
        protected mudclient rs;
        public Script(mudclient rs)
            this.rs = rs;
        public void start(String command, String parameters[])
        public String[] getCommands()
            return new String[0];
         public void AN(int idx) {
                      rs.dga[0] = 715;
                     rs.dfl[0] = rs.dgf[idx].gmh;
                     rs.dfm[0] = rs.dgf[idx].gmi;
                     rs.djk[0] = rs.dgf[idx].gmf;
                rs.emg(0);
    }Not quite sure wich wich java version I have, but I've tryed to compile with an online compilier that uses 1.5.0, and i still got the same errors... any help is appreciated :)

    This means the arrays inside mudclient are private and cannot be access inside Script.
    rs can be accessed but not the variables inside it.
    You should not be trying to do this in any case. Try to write your code so that variables are only accessed by methods in the same class.

  • How does private access scope manifest itself?

    Hi,
    I am in the process of converting an old project to use Project Libraries (*.lvlib). I have read and watched all the tutorials, LV Help sections, etc. I understand the benefits of using project libraries. But, I still do not understand how access to VIs is restricted after setting their scope to private. For example, I can create a new VI, outside the project library, then "Select a VI" to place on the block diagram, using a subVI with private access from a project library. And I can can run this test VI without any apparent problem.
    So, I seem to be able to access a 'private' VI. How and where is the access restricted for a VI with private scope?
    Thanks,
    RonC
    Solved!
    Go to Solution.

    Hi Chris,
    No example required...I can explain.     
    You know, after trying and trying to sort this out myself, and not being able to, I knew that when I asked, it would turn out to be something stupid. Here is what happened...
    I was using the "Data Acquisition Reference Design" project example as a reference to sort this out. I think this is an excellent one. I looked at the Configuration module and Display module sub-libraries, and the scope is just as described in the tutorials; i.e. the API VIs marked Public and the subVIs marked Private.
    Then, for my little example VI, I used a "Private" subVI from the Logging module, because it did not require any other resources to run, it just checked the root directory.  It worked fine, and hence my confusion. But, after you told me that should not work, I looked again, and out of the four sub-libraries used in the example, two (the two I looked at) have the access set as described, but the other two do not -- everything is Public. And, of course I used one of the public ones.
    I just tried again, using a "Private" subVI from the Display module, and although I can see it and place it on my block diagram, my calling VI is broken, the reason given is because of the private scope.
    Doh! I have only been doing this for 22 years, so not yet long enough to avoid the dumb mistakes I guess.
    Thanks for setting me straight.
    RonC
    P.S. I am using LV 2010 SP1

  • How can I create public AND private access with a wireless VPN router?

    I am thinking about getting one of the new pre-n wireless routers that has a builtin VPN.  I will need to have a private net for my office and a public net for my customers.  On the private side- my employees will need to access all network resources and servers etc.  On the public side, my customers just need to get to the Internet and maybe print on that side too.
    Both sides will be DHCP.
    Can I set this up with 1 device ro do I need 2?  How can I do this?  Any help is greatlu appreciated.
    Thanks all.
    Message Edited by Gman on 10-14-200607:08 PM

    The only safe way to do this is to creat user groups On your server and give specific assess to the users who log into the network.
    Using a single router , bifurcating a public from a private network is not possible.You will not be able to use the VPN since the users hav e to be connected to the VPN to log into your network.

  • Private access modifier

    is it best programming practice to always define my class variables as private ?
    Or should I just leave them as the default internal ?
    I notice on most code examples they are just left as internal default.
    Thanks

    declaring provate variable is always good as long as you dont need to restrict the scrope at maximum level.
    providing setter method for private member is like exposing to outer world.
    so, unless you need to change private variable value, you can use public/protected getter but setter with care!

  • Public & Private Access on same Access Point

    Hi folks -
    I recently purchased Cisco 1131AG Access Points, which have the ability to create VLAN's. I want to provide staff with wireless access, and also the guests with wireless access.
    Staff needs access to all network resources, and public needs just access to the Internet. In addition, I want to limit public to a certain bandwidth in addition to blocking them from downloading movies, music etc.?
    Can anyone recommend a way to do this?

    You're on the right track. You will need to configure two VLANs on the AP plus a default VLAN (which must be VLAN 1). You can then apply configure an SSID for each VLAN and apply security to each VLAN separately. You will then need to define the VLANs on your switches and configure the APs switchport as a trunk port.
    Once you've done this you will need to restrict access from the visitor SSID/VLAN so that all it can do is access the Internet, you'll need some means of issuing clients with an IP address, give them access to DNS, etc.
    As to limiting their bandwidth and blocking downloads, can't do that through the AP, that needs to be handled by your Internet connection and the devices that manage that.

  • Configuration Help Needed - Layout of Public Access and Private Access Network

    HELP
         I need help in laying out the following network - herre is my first stab at it.
    1. Actiontec DSL Modem - DHCP On     ----- Model GT701-WG
       WAN IP Address 12.17.66.203
       WAN SubNet Mask 255.255.255.255
       Lan IP Address 192.168.0.1
       Lan SubNet Mask 255.255.255.0
    2. WRT54G - DHCP On ----------------  Open to Public Access to the Internet
       Local IP Address 192.168.1.1
       Subnet Mask 255.255.255.0
    3. DellPowerConnect 2708 Switch ---  Open to Public Access to the Internet
    4. MS Windows SBS2003 Server   --- Closed to Public Access
        Connecting to the #2 WRT54G thru a Linsys network card
    5. WRT54G - DHCP Off - ??? --------- Closed to Public Access
        Connecting to another Linksys network card in the SBS2003 Server
       Local IP Address 192.168.1.2     ???
       Subnet Mask 255.255.255.0
    6. Linksys SD216 Switch                 --- Closed to Public Access
    Any help would be greatly appreciated

    I got the network setup, but did not get what you are trying to do. Do you have 2 WRT54Gs there? Are you trying to turn off DHCP server of second WRT54G? A detailed information would be appreciated.

  • Typesafe enums with private access - strange or useful?

    Given the class listed at the bottom, you'll notice that it's possible to specify a typesafe enum, and restrict that enum to clients in such a way that - and here's the strange part - the constant class is not exported in the api, despite the fact that it's required as an argument to the constructor.
    In other words you can legally state:
    MyClass myClass = new MyClass(MyClass.PLAIN);but not:
    MyClass.Constant constant = MyClass.PLAIN;
    MyClass myClass = new MyClass(constant);Anyone else noticed this? (Still coming to terms with the meaning of it).
    /k1
    Example code:
    * Type safety demo
    package blah;
    * Demo class showing the use of inaccessible constants
    public class MyClass {
         /** My first constant */
         public static final Constant FIRST;
         /** My second constant */
         public static final Constant SECOND;
         /* The instance constant field */
         private Constant constant;
         /* static initialiser for the constants */
         static {
              FIRST = new Constant("First");
              FANCY = new Constant("Second");
          * @param constant The constant spec
         public MyClass(Constant constant) {
              super();
              this.constant = constant;
         private static class Constant {
              private String name;
               * @param name The name of my constant
              public Constant(String name) {
                   this.name = name;
    }

    And indeed outside the package...
    package blah.test;
    import blah.*;
    public class Driver {
          * Main method for the sake of demonstration...
         public static void main(String[] args) {
              Object[] constants = MyClass.VALUES;
              for (int i = 0; i < constants.length; i++) {
                   System.out.println(constants);
                   MyClass myClass = new MyClass(constants[i]);
                   System.out.println(myClass);
    ...then...
    * Type safety demo
    package blah;
    * Demo class showing the use of inaccessible constants
    public class MyClass {
         /** My first constant */
         public static final Constant FIRST = new Constant("First");
         /** My second constant */
         public static final Constant SECOND = new Constant("Second");
         /** An array of the constants */
         public static final Constant[] VALUES = { FIRST, SECOND };
         /* The instance constant field */
         private Constant constant;
          * @param constant The constant spec
         public MyClass(Object constant) {
              super();
              if (constant instanceof Constant) {
                   this.constant = (Constant)constant;
         private static class Constant {
              private String name;
               * @param name The name of my constant
              public Constant(String name) {
                   this.name = name;
               * @return The name of the constant
              public String toString() {
                   return name;

  • What about if someone had private access to your phone and hacked in?

    Someone either lifted my BB or it fell out of my purse at a "friend's" house and when I retrieved it the next morning, some things started making me suspicious:
    1.  An apps icon that I had not downloaded was on my desktop - although the Verizon rep told me that some BB apps are automatically added to your desktop and that this may have been the case here. 
    2. Mentioned a restaurant in a text message to a friend, and not 10 minutes after arriving, the suspected phone hacker showed up at the same location
    3. Rapid battery depletion with no excessive use
    4. Strange "radio" sounds coming from phone when idle 
    I have wiped my phone several times, and remain concerned because item #4 above happened after multiple wipes.  I am not sure that everything was deleted.... all of my photos, songs, videos etc are still on phone.  My address book was deleted.  I reinstalled a backup from February (the phone was missing one night - 4/16).  My phone book did not repopulate when backup was reinstalled.  I went to the Verizon store to have them setup my browser - none of my bookmarks had been wiped either. 
    My phone is still under warranty, and Verizon is sending me a replacement.  Will this end the issue?  Will I need to change my phone number?  I have over a year left on my Verizon contract and going with a new provider is not an option.  Please advise!!

    That's the great thing with ios is it uses a sandbox file system. So installing spyware confines it to its sandbox so it cannot access other file or track anything. Unless you jailbreak at that point there is no more sandbox.

  • Accessing private field of Derived object in Base class

    Hi,
    I have this piece of code I wrote a while ago to test something. The issue is accessing a private field of Base class in Base but of a Derived object.
    Here is the code:
    class Base
         private int x;
         public int getX()
              return x;
         public int getX(Derived d)
              // return d.x;
              return ((Base) d).x;
    }The commented code does not work but casting d to Base does.
    Can someone please explain the reasoning for this.
    Forgot to mention that the compilation error is that x has private access in Base.
    Thank you.
    Edited by: 953012 on Apr 1, 2013 8:42 AM

    >
    As I understand the explanation says that you can access any private member within the code of the class that encloses the private member. So in this case x is the private member and the line of code (return d.x) is in Base which encloses the private member. Does it have to do with the fact that the Derived class does not in fact inherit the private members of Base?
    >
    It has to do with the entire quote from the spec
    >
    A private class member or constructor is accessible only within the body of the top level class (§7.6) that encloses the declaration of the member or constructor. It is not inherited by subclasses
    >
    Your code is
    public int getX(Derived d)
              // return d.x;
              return ((Base) d).x;
         }The 'Derived' class is NOT 'the top level class that encloses the declaration of the member'. It does NOT inherit 'x' which is a private member of 'Base'. As far as the 'Derived' class is concerned 'x' does not exist.
    >
    If outside Base code I have Derived d = new Derived() and I call d.getX() then isn't that like calling d.x in myX()?
    >
    How is that the same? 'Base' owns 'x' and can do whatever it wants with it. 'Derived' has no knowledge of 'x' and CAN NOT access it.

Maybe you are looking for