calling java method from unity c#

Hello everyone, Can anyone tell me how to call java methods from unity c#. I tried the following but its not working for me.

In Unity :

void OnGUI () {
    string somestring;
    AndroidJavaClass jc= new AndroidJavaClass("com.example.pluginsample.MainActivity");
    AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("instance");
    somestring = jo.Call<string>("Foo");
    GUI.Label (new Rect (20, 20, 100, 20), somestring);
}

In Java Class:

public String Foo()
{
    return "Hello";        
}

You missed the return type. Your code should be modified like this

AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("instance");  
string somestring = jo.Call<string>("Foo"); 

After that,put your compiled jar file in Assets/Plugins/Android in your project