Search:

Type: Posts; User: pbrockway2

Page 1 of 20 1 2 3 4

Search: Search took 0.19 seconds.

  1. Re: Help with Bin to Hex and Hex to Ascii program

    When the compiler says it "cannot find symbol" and then describes the symbol as a method of some class - here the nextString() method of the Scanner class - this generally means one of three things:...
  2. Re: Help with Bin to Hex and Hex to Ascii program

    The compiler is complaining here because you have put the type ("int") in as part of calling the method. So:



    //String binary = decStr.CheckCode(int dec);
    // should be
    String binary =...
  3. Re: Help with Bin to Hex and Hex to Ascii program

    The compiler is saying that nextInt() returns an int value, but you are attempting to assign it to binInput which you declared as a String. In fact the code where you declare this variable says:

    ...
  4. Replies
    2
    Views
    92

    Re: Parts of program being skipped?

    There's too much missing content to be able to figure out what "nothing in the code below between s.next() and the final else if statement works" means. And you say "the array never changes", but...
  5. Replies
    10
    Views
    128

    Re: Need some help with Private ArrayList

    queue.isEmpty() will throw a NullPointerException if items is null.

    I mentioned setting queue.items=null only as an example of the bad things that can happen if items is declared as public. It is...
  6. Replies
    2
    Views
    81

    Re: Need and assignment help

    Hi rigan123, welcome to the forums!

    I've merged your threads so all the discussion can be seen in one place.

    If you haven't come across it the Announcement thread has useful information about...
  7. Replies
    10
    Views
    128

    Re: Need some help with Private ArrayList

    Yes, the items instance variable would be public. So other code could say "queue.items.get(0)" but it could also say things like "queue.items=null" which might be a Bad Thing for the logic of the...
  8. Replies
    10
    Views
    128

    Re: Need some help with Private ArrayList

    It makes no sense for items to be static.

    items should be declared as private, but not static. A public getValue(int index) method should be implemented in the Queue class so that it returns the...
  9. Replies
    10
    Views
    128

    Re: Need some help with Private ArrayList

    Sorry, my previous post contained a typo. I was asking about the items member of Queue because it was declared as "static".

    If items is supposed to represent the items a queue instance has, then...
  10. Replies
    10
    Views
    128

    Re: Need some help with Private ArrayList

    What is items in the Queue class supposed to represent? I ask because it seems odd for it to be declared as "static".



    I would do that by implementing a public getValue() method in the Queue...
  11. Re: Question on Inheritance. What is wrong with my "smallest" variable's scope?

    Your code declares a class inside the main() method. That's not certainly wrong. But it's very probably not right.

    You had to declare things as static? No-one's pointing a gun at your head. ...
  12. Re: Help with 4 Multiple Choice Questions- reviewing for a final

    (2) Note that constructors are not methods. See JLS 8.8. Constructor Declarations, "Constructor declarations are not members." (8.2 makes it clear that "members" are fields, methods and types.)
    ...
  13. Re: Simulating a roll of d6 dice with Java code

    Exactly. It's important to get used to counting from zero (rather than one). See https://en.wikipedia.org/wiki/Off-by-one_error.

    No need to feel foolish! It took until the 9th century (CE)...
  14. Re: Simulating a roll of d6 dice with Java code

    Sorry if I've missed something and am confusing things... But your OP said the range should be 3->18, suggesting that these d6 things are like standard dice. But won't nextInt(7) give you a zero...
  15. Re: how can i populate my jlist using a mysql

    What you do is go back through your code to wherever it was that you thought you had assigned jList1 a value that was not null. What you must determine is why that didn't happen.
  16. Re: how can i populate my jlist using a mysql

    The first thing is to determine which variable is null. Use System.out.println() to print the values:


    System.out.println("About to set model");
    System.out.println("jList1 = " + jList1);...
  17. Replies
    2
    Views
    70

    Re: Java Collection Date Sorting Issue

    Probably some problem with the code you're using. Could you post a brief example of compilable code that is not giving the intended output?

    Date implements Comparable, but the sort methods...
  18. Re: How should I call in my main method? ~ Still Need Help

    It doesn't make sense to calculate the statistics or do any printing until after the loop filling the array has finished. So move those lines of code out off the loop.

    Also, you do need some way...
  19. Re: Trying to convert 2D array to String using toString() to print array

    The override annotation isn't required. Rather it alerts you to the sort of mistake you made (putting the argument in the to string() method.

    What happens when you try the code I suggwsted...
  20. Re: Trying to convert 2D array to String using toString() to print array

    You don't give the code where you are attempting to do the printing, but assuming you are attempting to override the toString() method of Object then it is very important to define the method with...
  21. Re: How should I call in my main method?

    //declare variables
    int numItems = 0;
    double [] iArray;
    iArray = new double[0];
    double min = Double.MIN_VALUE;
    double max = Double.MAX_VALUE;
    double sum = 0;
    double average = sum/numItems;...
  22. Re: How to add "FONT SIZE" and "FONT COLOR" button in Netbeans

    This is covered in the "How to Use Menus" lesson of Oracle's Tutorial. The whole Swing section may be useful (the link is from "Trail" at the top).
  23. Re: Making 2D array, and its not filling each "box"; code terminates early and gives error

    Your array is not square so it doesn't make sense to use f1.length as the index limit for both for loops. In fact (as I think you realise) it is the inner one that wrong. Your array is rectangular...
  24. Replies
    6
    Views
    131

    Re: Very basic question

    Thanks for the update.

    I was almost going to ask for what the book said exactly because using a switch statement to assign the letter grades didn't seem like such a clever idea. ...
  25. Replies
    6
    Views
    131

    Re: Very basic question

    Both things you have discovered are correct: you can't really use case 'A', case 'B', etc to check the grade value against, and you can combine multiple case values.

    A better approach might be to...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4