Search:

Type: Posts; User: veeer

Search: Search took 0.46 seconds.

  1. Replies
    16
    Views
    583

    Re: Having trouble returning an array

    A few words... you truly ought to be using a StringBuilder here, rather than a String, first of all. Secondly, the error is because the "enhanced for loop" i.e. for-each construct syntax is (roughly...
  2. Replies
    11
    Views
    773

    Re: Trouble with an array

    I believe what you may be looking for is a Map.


    enum ContactType {
    PERSONAL, BUSINESS
    }
    ...
    final Map<ContactType, Set<Contact>> contacts = new HashMap<>();
    ...
    public void...
  3. Replies
    14
    Views
    1,014

    Re: Casting java.lang.String to a custom class

    The culprit line is here. (PS aren't you from rune-server?)

    Class<Dialogue> dialogue = (Class<Dialogue>) Class.forName(file.getName().replaceAll(".class", "").getClass().getCanonicalName());...
  4. Thread: Initializing

    by veeer
    Replies
    4
    Views
    476

    Re: Initializing

    The reason the compiler is complaining is because you never once initialized `numberString`. I suspect you intended to initialize it with something like:

    numberString = keyboard.next();
    ... but...
  5. Re: how could I display a stack as FIFO instead of LIFO

    There are plenty of ways to do this. I'd advise you avoid using relics of the past like Stack in favor of using the newer Deque collection. I quote:

    You can even convert a Deque into a LIFO Queue...
  6. Replies
    11
    Views
    773

    Re: Trouble with an array

    What kinds of individual methods? Accessors and mutators for the type? Sure, but I see no benefit over using the constructor to pass your type in.
  7. Replies
    13
    Views
    739

    Re: Why doesnt my constructor work?

    You should consider calming down, and re-evaluate your situation. I apologize for suggesting you quit posting, but I was unsure of how to respond to your German equivalent of "fuck off". I also...
  8. Replies
    11
    Views
    773

    Re: Trouble with an array

    I see no reason why it shouldn't be exposed to the user, but if you must, just add a constructor parameter and seek adding a type field to the Contact class and add it to the class' constructor. That...
  9. Replies
    11
    Views
    773

    Re: Trouble with an array

    Why should the contact type *not* be apart of the Contact object? There's no real logical alternative... you should be seeking to maximize cohesion while minimizing coupling.
  10. Replies
    4
    Views
    272

    Re: how to catch the particular word?

    Not necessarily hidden... try reading through the relevant Java Tutorials trail.
  11. Replies
    13
    Views
    739

    Re: Why doesnt my constructor work?

    I believe you still are unable to understand the situation. You gave an incorrect explanation which I fully understood, thus being able to point out that it was incorrect. I didn't mean any hard...
  12. [SOLVED] Re: reading a stream of numbers from standard input

    Static methods are bad? So Math.sin is bad, eh? I understand what you're trying to say, but this is clearly not enterprise scale... you appear to have to some degree a naive understanding of unit...
  13. Re: How many programming languages a programmer could master in Real life.

    Just a side note - you can use Java with web development... I'd say it's a much less chaotic solution to web applications to use a Java solution (like servlets) over PHP. Take a look through here.
  14. [SOLVED] Re: reading a stream of numbers from standard input

    Really? Your approach would be to make a dedicated instance method to invoke on an object that has no real purpose? You'd manually read a token using scanner.next() and *then* parse it as an integer?...
  15. Replies
    3
    Views
    302

    Re: Why is the output always "0"?

    public class Test
    {
    public static void main(String args[])
    {
    final int NUM_row = 4;
    final int Num_columns=6;
    int[][] numbers = new int[NUM_row][Num_columns];
    Random randomNumbers =...
  16. Replies
    13
    Views
    739

    Re: Why doesnt my constructor work?

    I don't quite know what Voodoo is on about, considering your 'algorithm' (what algorithm?) is not wrong -- I'm not sure quite what he means when he speaks of 'ignoring' what is passed in the...
  17. [SOLVED] Re: reading a stream of numbers from standard input

    read() returns a character, not a parsed integer... read() will return, in order: '1' (49), '0' (48), ' ' (32), '3' (51), ' ' (32), '4' (52), ' ' (32), '9' (57), '9' (57), ' ' (32), '-' (45), '1'...
Results 1 to 17 of 17