Search:

Type: Posts; User: ashl7

Page 1 of 2 1 2

Search: Search took 0.42 seconds.

  1. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    Hey actually it did work out...sorry the first time I tested it my program had problem in another part that I didn't notice...but now I figured out what the problem was, it works just fine :)
    thanks...
  2. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    yeah
    but I'm looking for a way to display all the elements of the array on JTextField
    like this:
    a1jTextArea.setText(a[1].toString + " " + a[2].toString+ " " +.........a[10].toString)
    which...
  3. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    tnx, but didn't quite get that: you mean like this: a1jTextArea.setText(a[1].toString);
    any idea about the other questions?
  4. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    I guess I need your help again!
    this is the code for my Rational class that I asked in the first post, which is perfectly fine :>



    public class Rational{


    private long numerator;
    ...
  5. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    hmm, thanks much...got it!
  6. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    now why does it have to be "public static" and not just public?
  7. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    no wasn't trying to implement Comparable interface...I deleted that part from my program....just want to make a regular method to compare two rationals!
  8. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    hmmm, tnx
    I'm not finished with this one yet! I will add those methods later, but it won't give me a compile error, or run error later if I don't add them right?
    also, I made this method for...
  9. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    Hi...been a while, but I was working on my code, and learned some new stuff!!
    I've wrote this code so far:



    public class Rational extends Number implements Comparable<Rational>{


    ...
  10. Replies
    23
    Views
    618

    Re: Working with methods and constructors

    um I know why it's not a value, cuz it's a reference variable! that's not what my question is about, I'm more asking for a solution to get a rational number by calling a constructor Rational!
    I have...
  11. Replies
    23
    Views
    618

    Working with methods and constructors

    Hi, although by now I know enough about making methods and constructors, they're definition...I don't know why I have problem with this exercise of my teacher...now I don't want anyone to write the...
  12. Replies
    1
    Views
    368

    Finding the largest object in an array

    Hi, I have this exercise and kinda confuses me...I needed some help from professionals to clear things up for me(this is a school project, we haven't finished the course yet, so maybe some of the...
  13. Re: Working with numbers when there's "space" in between them

    changed it, still gives me error!!!!
    but found it finally
    same thing u said about arrays(confusing length and indexes)...I made a mistake in declaring the matrix array...it should have been a...
  14. Re: Working with numbers when there's "space" in between them

    GODDAMN IT!!!!!

    wait but I changed it to 9, still get the same error, except it's 9 instead of 8 in the error: java.lang.ArrayIndexOutOfBoundsException: 8
  15. Replies
    10
    Views
    295

    Re: modifiers for variable

    intBet is the user's input...the program is part of a GUI made by netBeans GUI maker!!! so I wasn't sure I should put it all here!

    --- Update ---

    @Chris Brown
    I see what you mean
    I got my...
  16. Re: Working with numbers when there's "space" in between them

    looks like I'm actually having a problem
    this is the code I wrote so far in order to get a matrix:



    package matrix.inverse;


    import java.util.*;
  17. Re: Working with numbers when there's "space" in between them

    I think I'm good (for now lol)....I was wondering how to use the method String.split()....did some google and found out it has to be like: StringName.split(" "), with space in between quotation...
  18. Re: Working with numbers when there's "space" in between them

    sorry for the delay...and thanks for the responses
    all the digits after a space has to be considered one number, for example 1 23 4 7 568 should be considered as 1,23,4,7,568....so the element of...
  19. Working with numbers when there's "space" in between them

    Hi, I'm working on a program about matrices...for getting the different elements of the matrix I must prompt the user as below:

    prompt example: Enter a11, a12, a13, a21, a22, a23, a31, a32, a33: ...
  20. Replies
    10
    Views
    295

    Re: modifiers for variable

    Hi again
    I know it's been a while, but wrote a piece of code, and can't find what my mistake is!
    it's about variables again



    public int result;
    private void...
  21. Replies
    10
    Views
    295

    Re: modifiers for variable

    Oooooh "the same class or package"...now I get it...and thanks for the link
  22. Replies
    10
    Views
    295

    Re: modifiers for variable

    Ok thanks a lot
    So you mean in general, we only use public, private, protected,etc... only when we want to make a class that is going to be used in some other program, or external codes?! in this...
  23. Replies
    10
    Views
    295

    modifiers for variable

    Hi,I needed to know why we should use modifiers for variables?
    I have this piece of code:



    import java.util.*;

    public class Test{

    public String student;
  24. Replies
    1
    Views
    229

    Question about data types

    Hi everyone
    I was studying about data types in Java, I have some basic questions

    what is the meaning of default value for a data type?! what's the use of it?
    for example:
    default value of int...
  25. Replies
    15
    Views
    412

    Re: Rather Basic Question

    Got it, I'm so stupid and thanks much :D
    it was in my if loop...I should have had variable u instead of j!
Results 1 to 25 of 36
Page 1 of 2 1 2