Creating an object based on the state of another object in Java -


Let's say that you have a name that is called a blast where it can be an example of it without any other information There is no point in class example constructor is not made public.

Is it better to do this:

  // Both classes are in the same package explosion; Collision c = New collision () // Do some stuff with collision e = c.createExplosion ()  

Or it is better to blast for a static method for example and As a logic in a collision object near you:

  Explosion and collision c = new collision () // Some stuff with collision e = explosion. Secure Explosion (c)  

When you are the author of both classes.

Why is the consignor not public? It seems to me wiser because there is a manufacturer for the explosion, which takes a collision context as a parameter.

In this way you may have:

  Explode e; Collision c = new collision (); // Some things with collision E = new explosions (C);  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -