Skip to main content
deleted 1 character in body
Source Link
user3409650
  • 533
  • 3
  • 13
  • 26

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public String id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void includeClientremoveClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public String id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void includeClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public String id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void removeClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

added 7 characters in body
Source Link
CMPS
  • 7.8k
  • 4
  • 32
  • 53

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public String id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void includeClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void includeClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public String id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void includeClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

deleted 6 characters in body
Source Link
Balázs Édes
  • 13.9k
  • 7
  • 60
  • 105

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
        public String id;

    public void includeClient() {
   
        String id = baseClass.createCleint();
    }

    public void includeClient() {
   
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
        public String id;

public void includeClient() {
   
        String id = baseClass.createCleint();
}

public void includeClient() {
   
        System.out.println(id);
}

in second function it returns null. Any idea?

I am new to java. I want to know how I can use the variable in the whole java class and keeping the value of it. Suppose in a method I fill the variable with a value and I want to use the value of it in another method.

public class Test {
    public id;

    public void includeClient() {
        String id = baseClass.createCleint();
    }

    public void includeClient() {
        System.out.println(id);
    }
}

in second function it returns null. Any idea?

Source Link
user3409650
  • 533
  • 3
  • 13
  • 26
Loading