title: is it possible to create a static object in a static method using Java
body: <p>i have a Java assignment and I would like to find out if I am currently on the right track...</p>
  
  <p><strong>The problem</strong> is that I am to create a new class name Tester and it stated that I do not need any instance variables nor constructors. Besides this class, I have 4 other class which is Product class, Lineitem class, Inventory class and money class. </p>
  
  <p>Next I am to add a method: <code>private static void addTestItems(inventory theInventory)</code>. </p>
  
  <p>This method is to allow me to add four different type of items to the inventory. For each, I will need to create a product object and then create a Lineitem object containing that product follow by using a addItem(), a method which i have declared in the Inventory class, to add the product object. </p>
  
  <p>The method is private as it is just a helper for another main method: <code>public static void test()</code> In this method, I will use this method to print out some output stating the product that was added into the inventory.</p>
  
  <p>What <strong>I manage to research</strong> is that in such class, I do not need to declare instance variable and constructor. Source: Answer #2 in <a href="http://www.allinterview.com/showanswers/62694.html" rel="nofollow">http://www.allinterview.com/showanswers/62694.html</a>.</p>
  
  <p>However, <strong>what I would like to know</strong> is that if I am able to create a static product object in this method. If not, how should I go about declaring the product object to be added into the Inventory class?</p>
  
  <p><strong>In addition to my curiosity</strong>, by not declaring instance variables and constructors and going straight to static methods, does this mean that this is a static class? Does anyone have a good example of a static class or static method in regards or is very similar to what I am facing? </p>
  
  <p>By the way, I am using BlueJ to do my assignment. I would like to thank everyone hwo read or help me with this problem And if you find this question to be a lousy one please comment and let me know how I can improve on it. By the way.</p>