how to pass the value of a variable that is created in the class A in class B

I need to pass the value of a variable That Is created in a class A to a class B. I'm still a beginner and I can not figure out how to proceed. Could you give me a hand?


Please see below 2 options for passing a String value: through the constructor and through a public setter method.

class A {
  void method() {
    String s = "test";
    B b = new B(s);

class B {
  private String value;

  B(String val) {
    value = val;

  public void setValue(String val) {
    value = val;

Need Your Help

Internet Explorer prevents domain user authentication in LightSwitch app

internet-explorer authentication windows-authentication visual-studio-lightswitch

In the LightSwitch Access Control tab I have Use Windows authentication and Allow any authenticated Windows user selected. Authentication works fine in Firefox/Chrome but fails in Internet Explore...

autocomplete in Solr and sunspot

ruby-on-rails autocomplete solr sunspot sunspot-rails

I'm building a website with RoR and I use Sunspot and the solr Search Engine. I needed to use autocomplete functionality but I couldn't.

Is this really asynchronous or does it happen so fast it doesn't make a difference?

javascript sqlite webdb

I'm trying to write a way to synchronously execute a set of sqlite queries within a WebDB environment. I've come up with what I think amounts to a synchronous routine, but I'm not sure how to test ...