Creating variable in one class, using other class to set its properties

Basically I have 2 classes. The main class has the main definition of all the variables, Box, Material, etc. Then I have another class called class2, it is supposed to initialize values and properties for each of the variables from the main class. The problem is, the class2 says java.lang.NullPointer Exception with



com.jme3.material.Material.(Material.java:166)





heres some code:

public class Main {

Material mat;

public static void main(String[] args) {

public void simpleInitApp() {

class2.Initialize();

}

}

}



public class2 extends Main {

public void Initialize(){

mat = new Material (“Common/MatDefs/Misc/Unshaded.j3md”);

mat.setTexture(“ColorMap”,assetManager.loadTexture(“Textures/goo.png”);

}

}



Please help me on this, because I need to split a lot of code into seperate classes.

You should learn more about what classes are and how they are used before you “split your code into classes”. Try to get a better grasp on what “object oriented programming” means and read a bit more in the wiki when you understand these concepts. Otherwise it makes more sense to keep it all in one file :stuck_out_tongue: