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. :-)

Similar Messages

  • How to set variables values via VBA.

    Anybody please help.
    How to set variables values via VBA in workbook. SAP Netweaver 2004s.

    Pass variable values with VBA and BI 7.0 funtions to Query
    At first a remark u2013 Iu2019ve read a lot of threads saying that passing values to a query can be done by using VBA code only. Iu2019ve tested it but Iu2019m not sufficient with the new BEX 7.0 API and therefore I use a mixture of BEX 7.0 funtionality and VBA. I create a BEX 7.0 design item button passing the values to a query u2013 I hide this button somewhere on the sheet or on a hidden sheet and I then raise the event to click the button from VBA code. Works fine and the maintenance is easier if something changes in the API in the future again.
    How to start:
    Switch to design mode in BEX Analyzer:
    Implement a BEX 7.0 design item u201Cbuttonu201D
    Click on the button to implement the properties
    Make the input for the commands
    data_provider = dataprovider_1
    cmd = process_variables
    subcmd = var_submit
    No comes the part with the variables u2013 Letu2019s assume a query has 4 variables but you only want to change 1 with the button u2013 an organizational unit for instance.
    Make a range somewhere in the excel with the following structure:
    Name    Index   Value
    VAR_NAME_1      1       Variablename
    VAR_VALUE_EXT_1 1       variablevalue
    Value should contain the name of your variable of course and u201Cvalueu201D the value of your variable
    Set a name for this range with EXCEL functionality but without the header:
    Back to the properties of the button: Insert the name of the range with the variables in the field Command Range:
    If you have more variables to process you can of course enhance your Filterrange!
    In the left upper Corner you have a name for your button:
    Now you can raise the button-click in vba like this:
    Application.Run "'" & ThisWorkbook.Name & "'!Sheet2.BUTTON_35_Click"
    regards, Lars

  • How can i see when someone has accessed my call/text log. (This is possible on google) I have been informed that someone has accessed my activity log and is giving my information to a third party. I believe it is a service tech, but I am not interested in

    How can i see when someone has accessed my call/text log. (This is possible on google/gmail) I have been informed that someone has accessed my activity log and is giving my information to a third party. I believe it is a service tech, but I am not interested in persuing that further. I just need to see when my account has been accessed if possible.

    Hi lynniewigs,
    This is a common concern among Android and I-phone user, and one of the drawbacks to using a smart phone.  We lose so much privacy. Our phones become cameras into our homes for us to be spied on.
    I don't know what type of phone you have, if it is even a smart phone, but here is an example of an application that you can use to determine which applications are accessing your information and sending it out. 
    Permission Scanner - Android Apps on Google Play
    Google just recently revamp their permissions geared to hide invasive applications that spy and send out your information without your knowledge.  Report says be aware of what your Android app does - CNET
    Please continue to be mindful of the apps you download and the permissions you give. 

  • How to set up Pymnt Method for different business units

    Hi,
    Can anyone shed some light as to how to set up P Method in FBZP in a way that one type can be identified according to its Business Unit?
    To clarify, FBZP is currently set up in a repeated way:
    Pymnt Methods:
    T - Transfer - Business Oil
    S - Transfer - Business Engineering
    V - Transfer - Business Equipment
    A - Boleto - Business Oil
    N - Boleto - Business Engineering
    C - Boleto - Business Equipment
    As you can see, we are repeating same payment method as it is needed for business to identify which business unit this refers to.
    Is there a way of setting up only one type of Transfer and one type of Boleto and how this will categorize the type of Business Unit ??
    Any input is welcome
    Regards
    Roger

    Hi Roger:
    How about some enhancement on F110? The logic would be something like read all the proposal lines, group by profit center and then re-assign the payment method based on profit center. There are couple of user exits available starting with RFFOX###, depending on the payment method and the program you using.
    Something similar to substitution rules user exit.
    Not sure if there is any other standard configuration to combine lines by profit center.
    Thanks.
    Rahul

  • How to set variable to run java and j2ee

    how to set variable to run java and j2ee

    Please ask a specific and comprehensible question. Consider describing with less vagueness the actual current problem that you are encountering.

  • 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 !

  • 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.

  • 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();

  • Am I able to find out how many times my ICloud account has been accessed?

    Am I able to find out how many times my ICloud account has been accessed?

    I'm afraid iCloud doesn't provide access logs.

  • How to know that a method has been called and returning value of a method

    Hi, everyone! I have two questions. One is about making judgment about whether a method has been called or not; another one is about how to return "String value+newline character+String value" with a return statement.
    Here are the two original problems that I tried to solve.
    Write a class definition of a class named 'Value' with the following:
    a boolean instance variable named 'modified', initialized to false
    an integer instance variable named 'val'
    a constructor accepting a single paramter whose value is assigned to the instance variable 'val'
    a method 'getVal' that returns the current value of the instance variable 'val'
    a method 'setVal' that accepts a single parameter, assigns its value to 'val', and sets the 'modified' instance variable to true, and
    a boolean method, 'wasModified' that returns true if setVal was ever called.
    And I wrote my code this way:
    public class Value
    boolean modified=false;
    int val;
    public Value(int x)
    {val=x;}
      public int getVal()
      {return val;}
       public void setVal(int y)
        val = y;
        modified = true;
         public boolean wasModified()
          if(val==y&&modified==true)
          return true;
    }I tried to let the "wasModified" method know that the "setVal" has been called by writing:
    if(val==y&&modified==true)
    or
    if(x.setVal(y))
    I supposed that only when the "setVal" is called, the "modified" variable will be true(it's false by default) and val=y, don't either of this two conditions can prove that the method "setVal" has been called?
    I also have some questions about the feedback I got
    class Value is public, should be declared in a file named Value.java
    public class Value
    cannot find symbol
    symbol  : variable y
    location: class Value
    if(val==y&&modified==true)
    *^*
    *2 errors*
    I gave the class a name Value, doesn't that mean the class has been declared in a file named Value.java*?
    I have declared the variable y, why the compiler cann't find it? is it because y has been out of scale?
    The other problem is:
    Write a class named  Book containing:
    Two instance variables named  title and  author of type String.
    A constructor that accepts two String parameters. The value of the first is used to initialize the value of  title and the value of the second is used to initialize  author .
    A method named  toString that accepts no parameters.  toString returns a String consisting of the value of  title , followed by a newline character, followed by the value of  author .
    And this is my response:
    public class Book
    String title;
    String author;
      public Book(String x, String y)
       { title=x; author=y; }
       public String toString()
       {return title;
        return author;
    }I want to know that is it ok to have two return statements in a single method? Because when I add the return author; to the method toString, the compiler returns a complain which says it's an unreachable statement.
    Thank you very much!

    Lets take this slow and easy. First of all, you need to learn how to format your code for readability. Read and take to heart
    {color:0000ff}http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html{color}
    Now as to your first exercise, most of it is OK but not this:   public boolean wasModified()
          if (val == y && modified == true)
                return true;
    y being a parmeter to the setValue method exists only within the scope of that method. And why would you want to test that anyways? If modified evaluates to true, that's all you need to know that the value has been modified. So you could have   public boolean wasModified()
          if (modified == true)
                return true;
       }But even that is unnecessarily verbose, as the if condition evaluates to true, and the same is returned. So in the final analysis, all you need is   public boolean wasModified()
          return modified;
       }And a public class has to be declared in a file named for the class, yes.
    As for your second assignment, NO you cannot "return" two variables fom a method. return means just that: when the return statement is encountered, control returns to the calling routine. That's why the compiler is complaining that the statement following the (first) return statement is unreachable.
    Do you know how to string Strings together? (it's called concatenation.) And how to represent a newline in a String literal?
    db

  • How to set the view, which has to be shown at runtime?

    Hi,
    in my application i have more than one view, but at runtime only one of these views has to be shown. I want to decide this via a parameter that I get from the url.
    How can i set the right view to be showing at runtime?
    I tried it with a StartView which fires the right Outbound Plug in his wdDoInit-Method. This is working fine, but the problem is, that the method OnPlugDefault() of ComponentInterfaceViewController isn't called already at this time. So in the Init-Method of the StartView I don't have the given URL Parameter, so I can't decide which Plug I want to fire. The method OnPlugDefault() is called only after the init-method of the StartView.
    Is there any other possibilty to set the view, which has to be shown, at runtime?
    Thanks and Best Regards
    Katharina

    Hi,
    One way is you can pass the parameter in the URL , read the parameter and then fire the outbound plug depending upon that.
    You can read the parameters as follows
    HttpServletRequest request =Task.getCurrentTask()
         .getWebContextAdapter()
         .getHttpServletRequest();
    String[] param1 = request.getParameterValues("<<PARAMETRNAME");
    if(param1.equals("VALUE"))
      fire outbound plug1;
    Regards, Anilkumar

  • I am using a WD external hard drive for backing up my laptop with Time Machine, but I have to do it manually. How do I know when it has finished the back up? How long should it take?

    I am using an external WD hard drive for backing up my laptop. I have to do it manually, so I can't set Time Machine to just do it for me. How do I know when it is done backing up? How long should this take?

    Triple-click anywhere in the line below to select it:
    tmutil compare -E
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    The command will take at least a few minutes to run. Eventually some lines of output will appear below what you entered.
    Each line that begins with a plus sign (“+”) represents a file that has been added to the source volume since the last snapshot was taken. These files have not been backed up yet.
    Each line that begins with an exclamation point (“!”) represents a file that has changed on the source volume. These files have been backed up, but not in their present state.
    Each line that begins with a minus sign (“-“) represents a file that has been removed from the source volume.
    At the end of the output, you’ll get some lines like the following:
    Added:
    Removed:
    Changed:
    These lines show the total amount of data added, removed, or changed on the source(s) since the last snapshot.

  • How to set variable value in an XML array

    Hi,
    Please let me know how to set the value for a xml array element using assign activity inside a for-each block in BPEL 11g
    I tried to set the variable value for result element using the below condition but i encountered selection failure message
    $outputVariable.payload/ns1:Student['i']/ns1:result or
    $outputVariable.payload/ns1:Student[$i]/ns1:result
    And the xsd used is as below
    <xsd:complexType name="StudentCollection">
    <xsd:sequence>
    <xsd:element name="Student" type="Student" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Student">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="location" type="xsd:string"/>
    <xsd:element name="mark" type="xsd:string"/>
    <xsd:element name="result" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    Thanks,
    Dhana

    Hi,
    At the back of button specify the following parameter:-
    CMD    1        Execute_planning_function
    Planning_function_name  1   xyz
    Var_name     1    variable_name
    var_value      1    blank
    Can also refer to link below:-
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0a89464-f697-2910-2ba6-9877e3088954?quicklink=index&overridelayout=true(can refer to page 20)
    http://www.sdn.sap.com/ddc5564a-337d-4cf9-a34e-2dab64df09be/finaldownload/downloadid-a61a6724ba8e7b7fbd9c5df9590ab50d/ddc5564a-337d-4cf9-a34e-2dab64df09be/irj/scn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be?quicklink=index&overridelayout=true
    Hope it may help

  • How to set variable value in BEX analyzer for IP Layout

    Hi All,
       I have created a simple planning function to copy data from one account to another and I have used mandatory selection variable for Fiscal year /period. When I execute the planning function through Planning modeler I get the prompt for the variable and the planning functions execute without errors and return the values. But now when I design the Bex workbook using my Input ready query that have button to execute the planning function,I don't get the prompt for the mandatory selection variable. I need to set the variable vaule in design mode then the function return the values. Is there way to get the prompt for the variable when I choose to execute the planning function. Also is there a option in Web application designer too?
    Please let me know what I'm missing.
    Appreciate you help.
    regards,
    Balaji

    Hi,
    At the back of button specify the following parameter:-
    CMD    1        Execute_planning_function
    Planning_function_name  1   xyz
    Var_name     1    variable_name
    var_value      1    blank
    Can also refer to link below:-
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0a89464-f697-2910-2ba6-9877e3088954?quicklink=index&overridelayout=true(can refer to page 20)
    http://www.sdn.sap.com/ddc5564a-337d-4cf9-a34e-2dab64df09be/finaldownload/downloadid-a61a6724ba8e7b7fbd9c5df9590ab50d/ddc5564a-337d-4cf9-a34e-2dab64df09be/irj/scn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be?quicklink=index&overridelayout=true
    Hope it may help

  • How to set variable values in Stored Procs

    Hi all,
    please excuse my newbie questions - I've spent too long using SQL Server......
    Anyway,
    I'm playing with SP basics and was wondering how I can set a variable value in a stored proc, ideally getting a value from a table or some select .
    for instance...........
    CREATE OR REPLACE PROCEDURE RPT_SP_ANT_TESTING
    P1 IN NUMBER,
    P2 IN VARCHAR2
    IS
    TmpNum NUMBER;
    TmpStr VARCHAR2(255);
    BEGIN
    --How do set these?
    SET TMPNUM := SELECT Count( * ) FROM ALL_TABLES;
    SET TMPSTR := P2 + '_APPENDED';
    INSERT INTO TEST_TABLE
    ( STRINGFIELD, NUMBERFIELD )
    VALUES
    ( TmpStr, TMPNUM )
    END;
    Regards
    DC

    Some ways are...
    setting directly
    x := 1;
    setting from a select use INTO clause
    select 1 into x from dual
    setting from a select into a collection type use BULK COLLECT INTO
    select name bulk collect into lName from your_table.
    It would be better if you read the document.
    Thanks,
    Karthick.

Maybe you are looking for

  • MIRO - Table Name

    Hi frnds, i need the table and field which is showing on header of MIRO transaction. for ex. if u click the Transaction of MIRO drop down list we will get 4 values. i.e. 1. Invoice       2. Credit memo       3. Subsequent debit       4. Subsequent cr

  • Multiple website, one MobileMe account

    OK, so I have created a webiste already and it is located on a domain name that I bought from GoDaddy. I have just purchased ANOTHER domain name and want to create another website with that domain using iWeb '08. How do I do that?

  • Differnce Between /n and /BEND

    Hi, Differnce Between /n and /BEND? thanks and regards sarath

  • Launch Integration Builder  - Checking version

    I have recently received a new laptop at work. When I launch the Integration Builder: Design and Integration Builder: Configuration from the web page, it says checking for latest version before actually launching the application and this takes ages.

  • Missing delivery information in 2LIS_12_VCITM

    Please let me know how to check particular sales order details data  in 2LIS_12_VCITM delivery data source.  my problem here is I am missing delivery data coming from 2LIS_12_VCITM to one of the dso IN BW side. so i need to find out weather particula