Search:

Type: Posts; User: Shaybay92

Search: Search took 0.20 seconds.

  1. Replies
    2
    Views
    633

    Re: Stack implementation and shallow copy

    Am I thinking about this wrong?... is it only if I alter the object its referencing (using mutator methods) rather than the variable holding the reference? I think this might be my issue.. so if I...
  2. Replies
    2
    Views
    633

    Stack implementation and shallow copy

    Im new the the shallow copy/deep copy concept. I need a little help understanding whats actually going on in this implementation:


    public class Stack1 {

    private Object value;
    private Stack1...
  3. Replies
    1
    Views
    455

    Quicker equality check?

    I have an if statement and the entry condition requires the checking equality of a character against several other characters. Is it possible to put these several characters into a list to shorten...
  4. Replies
    3
    Views
    1,252

    Re: Using Comparable in Binary Search

    I understand that I have to implement the interface to use a data type as a 'comparable'.. however this is not my issue. The issue is that I want my list to contain any type which implements...
  5. Thread: divisibility

    by Shaybay92
    Replies
    4
    Views
    980

    Re: divisibility

    Why didn't they use 0 - 9 ASCII for the numbers 0 - 9? Seems unnecessarily confusing to me!
    So when you cast '9' to an int, you are actually getting the internal ASCII representation of '9'. From...
  6. Replies
    3
    Views
    1,252

    Using Comparable in Binary Search

    So I have written some code which tells whether a certain Integer is within a list of integers. I tried to do this with a comparable type instead of 'integer' type, but I realised that this wouldn't...
  7. Replies
    1
    Views
    757

    JButtons not showing

    I have googled this issue and apparently it is common, but I'm not sure how to fix it in my case... I think it has something to do with mixing Swing and Awt libraries... Anyway, I am trying to create...
  8. Re: Trying to start a game when 'Enter' is pressed.

    I have been advised to not use key bindings by my tutor.. Is there a way to do this without it? Surely the code above should work!! Even when I change it to another key being pressed for example 's'...
  9. Re: Trying to start a game when 'Enter' is pressed.

    I don't know what Key Bindings are, however I think I may just change it to pressing a JButton to start the game instead... Hopefully this will work. :| I've definitely added the listener to the...
  10. Trying to start a game when 'Enter' is pressed.

    I have a game working successfully with arrow keys, so I know my KeyListener class is fine (canvas is an object of the KeyListener class). So I wanted to add a menu to my game, so that it will have a...
  11. Replies
    1
    Views
    419

    Adding sound to a game application

    So I would like to loop background music for a game I am making, but I don't want to use the applet library. Is there a way I can do this? My file is .wav and about 21MB. I tried using a tutorial...
  12. Replies
    3
    Views
    548

    Re: Accessing fields of a subclass

    Nevermind. I ended up writing the method for each subclass, and defining it as being an abstract method in the super class. This way I could refer to the method using an object from the superclass as...
  13. Replies
    3
    Views
    548

    Accessing fields of a subclass

    If you want a method to intake an object of a superclass type, but you want it to do things differently depending on what subclass it is, is it possible to take input as the superclass, and then...
  14. Replies
    4
    Views
    514

    Re: Wanting to repeat my program...

    Thanks for the tip. When I run the program it prints inputRepeat as nothing.. I just get an output of:

    inputRepeat=<

    So are you saying when the previous line is printed in console, it takes the...
  15. Replies
    4
    Views
    514

    Wanting to repeat my program...

    So I have created a program to tell whether a number is a prime number or not. I basically did this by finding the modulus of the number with all numbers less than it. If the modulus is 0 for any...
  16. Replies
    10
    Views
    659

    Re: Noob question: Why .class?

    So what exactly is the definition of a class then? How do you justify calling HelloWorld a class? I was looking at this link:

    What Is a Class? (The Java™ Tutorials > Learning the Java Language >...
  17. Replies
    10
    Views
    659

    Re: Noob question: Why .class?

    I suppose what I meant is that the primary function of the HelloWorld.class file is not to define a class within it, it does use them, but it itself just prints the words out... From what I know a...
  18. Replies
    10
    Views
    659

    Noob question: Why .class?

    I'm using Eclipse as my IDE for Java coding, and noticed that all files are .class, even if they do not define classes within them... From what I know so far, classes are templates for objects, so...
Results 1 to 18 of 18