Right now I have to create a new physical file in eclipse android for every public class I create
For eg if I have the below 2 classes (System and Region) like this:
Region.java file:
package com.acrossair.tvguideuk;
public class Region
{
public int RegionID;
public String Name;
}
System.java file:
package com.acrossair.tvguideuk;
public class System
{
public int SystemID;
public String Name;
}
How can I simply create a file CustomObjects.java and have all of these custom classes in 1 single file?
You could create your custom objects as public inner classes of a CustomObjects
class:
public class CustomObjects {
public class Region {
public int RegionID;
public String Name;
}
public class System {
public int SystemID;
public String Name;
}
}
But you couldn't use static members in the inner classes unless they were static themselves.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With