Small help needed

I'll show u a part of my code. plz help me out.

Package aaa;
It has two java classes.
1) class a(
2) class b(

The output of class a is a String s;
I want to use this String s in class

Can u help me write the code.?

Thanks in advance.


  • For example this way:
    [b]package ptCCV;

    public class a
    public String s="abcd";
    [b]package ptCCV;

    public class b
    public b()
    a oa=new a();
  • Thanks a lot!!! :)
  • It says "non-static variable op cannot be referenced from a static context".

    op is the name of the variable i used. In ur example it is s.
  • I use this way:

    [b]package ptCCV;

    public class cmain
    public static void main(String[] args)
    b ob=new b();

    Maybe I did not understand what you need? Let me know if you have questions!
  • This post has been deleted.
  • Hello, post here your code ... so it's easier to tell what's wrong with it..
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!