Well i am Referring Some basic Fundamentals of the java and as i come across to the Stack and Heap. as my understanding Heap is the main memory where the instance means object of the class will be stored and class Variable will be stored.
look about the stack storing all the method and the local variables and the method.
now my confusion is if i create any class object let say String object Locally into the method and its instance of the class String then where it can be stored. i did not got the proper conclusion for this can anybody suggest.
and i would apology if there if this could be duplicate of any other because i could not find similar so to clear my understanding i need help.
here the working example.
public class CreatingLcoalString {
public void methodstring(){
String s = new String("This is the area of confustion"); // this is the area of confustion
System.out.println(s);
}
public static void main(String argsp[]){
new CreatingLcoalString().methodstring();
}
}