Check out example codes for "how to store data in objects java". It will help you in understanding the concepts better.

Code Example 1

class Test { 
      
// class contents 
void show()  
{ 
    System.out.println("Test::show() called"); 
} 
} 
  
public class Main { 
      
    // Driver Code 
    public static void main(String[] args) 
    { 
          
        // all objects are dynamically  
        // allocated 
        Test t = new Test();  
        t.show(); // No error  
    } 
}

Learn ReactJs, React Native from akashmittal.com