Java create an object of the non-static class Reptile

Java create an object of the non-static class Reptile

To create an object of the non-static class Reptile in Java, you can use the following code:

Reptile reptile = new Reptile();
So‮ww:ecru‬w.lautturi.com

This creates a new object of the class Reptile called reptile. The new keyword creates an instance of the class, and the Reptile constructor is called to initialize the object.

If the Reptile class has any non-static fields, you can set their values using the dot notation, like this:

reptile.name = "Lizard";
reptile.color = "Green";

You can then call the methods of the Reptile class on the object, like this:

reptile.move();
Created Time:2017-11-03 00:14:42  Author:lautturi