Search:

Type: Posts; User: MrLowBot

Search: Search took 0.10 seconds.

  1. Replies
    22
    Views
    782

    Re: Static in a non static

    Thanks, i got it working now!
    Atleast i think so haha.

    :D


    public static String tostring(int[] arr) {
    String str1 = null;
    String strk = " ";
    for (int i = 0; i < Arr.length; i++) {
  2. Replies
    22
    Views
    782

    Re: Static in a non static

    n = 3 4 5 6 7. Thats what it should print out!
  3. Replies
    22
    Views
    782

    Re: Static in a non static

    Lets just say this. I want a code that takes the info from an array, can be static or in main, and prints it out from its String method when we call for it.
    Say take this one step at the time. And...
  4. Replies
    22
    Views
    782

    Re: Static in a non static

    I want to get the numbers from the array without touching any lib and pass them to a string
    and print them out.
  5. Replies
    22
    Views
    782

    Re: Static in a non static

    Well lets start back at the begining then....
    I have this class that i need to make a couple of static methods, i am not allowed to use the lib.
    The main method is there to act as a testprogram...
  6. Replies
    22
    Views
    782

    Re: Static in a non static

    Yeah.
    Been altering the code much too from what they wanted from post 5.


    public class arraykm {
    static int[] arr = { 3, 4, 5, 6, 7 };

    public static void main(String[] args) {

    int...
  7. Replies
    22
    Views
    782

    Re: Static in a non static

    Well that's good to know however.. i am not allowed to use any of the help from the lib.
    And on top of that i think that i should be able to get the info from the n array and not from the
    static...
  8. Replies
    22
    Views
    782

    Re: Static in a non static

    Exception in thread "main" java.lang.StackOverflowError
    at km222nb_lab3.Arrays.toString(Arrays.java)
    at km222nb_lab3.Arrays.toString(Arrays.java:32)
    at...
  9. Replies
    22
    Views
    782

    Re: Static in a non static

    This is what my task says I should be able to do.


    The method String toString (int [] arr) that builds a string and it prints out the content of the array.
    It should be able to be used as...
  10. Replies
    22
    Views
    782

    Re: Static in a non static

    I get "Cannot make a static reference to the non-static method toString() from the type Object".
    I thought that i could call it from "System.out.println(toString());" in the main, but i guess that...
  11. Replies
    22
    Views
    782

    Static in a non static

    Hey!

    The the code that i have must be able to, via a method, take an array of numbers and make them into a string and then return to print them out.
    There is two parts of this code so far (two...
Results 1 to 11 of 11