Search:

Type: Posts; User: andbin

Page 1 of 20 1 2 3 4

Search: Search took 0.25 seconds.

  1. Replies
    1
    Views
    185

    Re: What is wrong with my code/class?

    From the code it's evident that StarsAndStripes is declared inside the main method. Classes can be declared into methods/constructors. These are called "local inner classes" and this is an advanced...
  2. [SOLVED] Re: Design Suggestion - JList with checkbox option

    You may use JTable. Having a checkbox in all cells of a certain column is absolutely trivial. It is sufficient that the table model exposes Boolean.class as the Class for that column. You don't need...
  3. Replies
    5
    Views
    138

    Re: Binary Search using While loop for String

    When you find the value (third if in while) you should terminate the loop. Your loop does not currently terminate in that case. ;)
  4. Re: Reading xml file names in directory and its sub directories

    There is one issue ... you lose the path of the file. In other words, you keep only simple base names. If this is what you want, ok. Otherwise, change it.
  5. Replies
    7
    Views
    257

    Re: NoClassDefFoundError, but Why?

    I know ( ;) ) that you are a beginner, so please try to understand the following issues:

    a) It's not a good choice a package name in UpperCamelCase and, most important, exactly the same as the...
  6. Replies
    1
    Views
    122

    Re: Struggling To Import Images To PacMan Game

    The path you specified is a path directly on the file-system. And it's relative to the "current" directory. What is the current directory when you run the application? Can you control it? ;)
    ...
  7. Replies
    2
    Views
    342

    Re: help me out please

    That code is Javascript ... not Java. Find a Javascript forum. ;)
  8. Replies
    2
    Views
    169

    Re: Whats wrong with Scanner

    Always pay attention when you mix the use of nextLine() and other nextXYZ() methods.
    You can also decide to only use nextLine and then parse numbers separately.
  9. Re: I am not getting the desired output. When i am printing the value of 'i' it is showing 0, 01, 11, 21.... like this. Whats wrong in the code.

    Please, note that here

    if(i==j);

    There is a ; which causes an "empty" statement

    And also:
    - use j<r instead of j<=r-1 (it's clearer)

    - the output of "Enter Numbers to Row " + i+1
  10. Re: File Appending JOptionPane.showInputDialog Infinite While Loop Problem

    Content of strings (and of objects in general) must be compared for equality using equals() method. Not with == or !=

    And in your scenario a do-while is more appropriate than the while. ;)
  11. Replies
    2
    Views
    195

    Re: Very short beginner code, please help.

    These variables are all zero value (zero * any valid value is zero)


    You input some values but you do NOT use them in the following line.


    weightKg and heightM are still zero....
  12. Replies
    2
    Views
    154

    Re: Weird Timer issue

    Without seeing the code, it's rather hard to tell what's wrong.
  13. Re: please help me to print words from given number

    You need to know all the rules to form English numerals, with also all special/corner cases.
    Take a sheet of paper (or a computer text editor ;) ) and write down all the english numerals from eg. 0...
  14. Replies
    3
    Views
    152

    Re: possible loss of precision

    Compound assignment operators like += include an implicit cast.
    See Java Language Specification 15.26.2: https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.26.2


    This does not...
  15. Replies
    2
    Views
    177

    Re: JScrollPane resize dinamically

    The JScrollPane is into a JPanel that has a FlowLayout (that "respects" the preferred-size of components). And indeed you have used setPreferredSize on JScrollPane. For this reason it's...
  16. Replies
    1
    Views
    361

    Re: Regular expression and replaceAll

    Are attributes (id/type/p/etc..) always in that order? Why id is "mainid (85)" and you just want only 85? Since it's XML, are you sure attributes don't contain entities like &amp; or other? (for what I...
  17. Thread: Beginner

    by andbin
    Replies
    1
    Views
    265

    Re: Beginner

    Just a note of caution: this is very similar to saying "I am learning to swim and I am also going to the World swimming championships".
    So be careful about this. ;)
  18. Replies
    6
    Views
    258

    Re: why doesn't it work??? (eclipse)

    Ignore so called "video tutorials". Study Java on great, valid books and/or on the official tutorial: Nested Classes
  19. Replies
    6
    Views
    258

    Re: why doesn't it work??? (eclipse)

    For what can be seen in the posted code, the class Circule is an "inner" class. Inner/nested classes are an "advanced" concept of the Java language that I suspect you are not aware of.
    So, please,...
  20. Re: Adding Binary numbers in array element by element

    No, sorry, your code is extremely too long and complex. If I would show you my implementation you would be .. literally "shocked". ;)
  21. Re: What is wrong with my code?? Program: Count the number of consonants in a given string

    First of all, the line with toCharArray can better be outside (before) the loop. It's a thing that doesn't change in the loop. It's also preferable a for loop instead of a while.

    But the big...
  22. Replies
    3
    Views
    333

    Re: BigDecimal rounding problem

    HALF_UP: Behaves as for RoundingMode.UP if the discarded fraction is ≥ 0.5; otherwise, behaves as for RoundingMode.DOWN

    the 4 is not ≥ 5 ;)
  23. Thread: Inexcusable !

    by andbin
    Replies
    3
    Views
    195

    Re: Inexcusable !

    JDK version/IDE version?

    Seems really strange because ...


    public class AnnotTest {
    public static final String SOME_STR = "aConstant";

    @MyAnnot(SOME_STR)
    private String item;
  24. Replies
    4
    Views
    172

    Re: Abstract Class with non abstract method

    A class is marked abstract when it makes no sense to instantiate it. Think about a Figure2D class and some subclasses like Circle, Triangle, Rectangle, etc.
    Do you think has sense to do new...
  25. Replies
    2
    Views
    125

    Re: Problem using modpow BigInteger

    modPow


    Always see javadoc documentation!
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4