answersLogoWhite

0

How do you pass objects to methods?

User Avatar

Anonymous

12y ago
Updated: 8/20/2019

The same way as you pass a non-object parameter; for example:

String x = "Hello";

doSomething(x);

(In Java, a String is an object, but this works just as well with an object created with the "new" keyword.)

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Does light pass through objects?

sometimes it pass through objects


Why java is not a complete object oriented language?

Java is not a completely object oriented language, because not all values in Java are Objects. For example, the basic numeric types such as int, long, double, etc., are not objects and need to be "boxed" into objects in order to pass them as Object parameters or call methods on them.


Which objects light can pass through?

an objects light can pass through is transparent


Can you explain in which scenario the primitive types are used as objects?

It is sometimes easier to deal with primitives as objects. Moreover most of the collection classes store objects and not primitive data types. And also the wrapper classes provide many utility methods also. Because of these resons we need wrapper classes. And since we create instances of these classes we can store them in any of the collection classes and pass them around as a collection. Also we can pass them around as method parameters where a method expects an objectIt is sometimes easier to deal with primitives as objects. Moreover most of the collection classes store objects and not primitive data types. And also the wrapper classes provide many utility methods also. Because of these resons we need wrapper classes. And since we create instances of these classes we can store them in any of the collection classes and pass them around as a collection. Also we can pass them around as method parameters where a method expects an object


Objects that don't let light pass through them?

Objects that don't let light pass through them are called opaque. These objects absorb or reflect light, preventing it from passing through. Materials like wood, metal, and cardboard are examples of opaque objects.


Can sound energy pass through opaque objects?

Sound energy cannot pass through opaque objects as they block the transmission of sound waves. Opaque objects do not allow sound waves to propagate through them, unlike transparent or translucent objects.


What do not allow light to pass through?

opaque objects


Can light pass through all objects?

yes


What kind of light can objects completely pass through?

Objects can completely pass through transparent materials, such as glass, clear plastic, or water. These materials allow light to pass through with minimal scattering or absorption.


Why can light pass through clear objects?

Light can pass through clear objects because these objects are made up of materials that do not absorb or reflect light significantly. Instead, light is able to travel through the material without being scattered or absorbed, allowing it to pass through and transmit its energy to the other side.


What are the three methods of charging objects?

Friction Induction Conduction


How do ants carry things and what methods do they use to transport objects?

Ants carry things by using their strong jaws and mandibles to grasp and lift objects. They also use their bodies to form chains or lines to pass objects along to their nest. Additionally, some ants have specialized adaptations, such as sticky pads on their feet or enlarged heads for carrying larger items.