Java declaration of variable doubt

0

I do not know what the subject of this part of java is, but I did not understand it:

Carro carro;

I know that when declaring the variable we do:

String carro;

Why is there a car type ??? being the types integer, boolean, string, float, double?

Could someone please explain something to me?

    
asked by anonymous 10.11.2018 / 07:11

2 answers

2

Car is a class created by (you) programmer, and in the declaration you are instantiating the class Car that should be Carro carro = new Carro(); Already string, boolean and etc are primary (native) data types of the language. So when you use: String carro; you are using the string class (Native of the Java language) and assigning the car name, soon a variable type string called car. When you create and use the class, it's as if you were using "String" however you created the class, its methods and etc., and giving the car name.

In this link you can better understand the function and use of classes which is very important: Click Here

    
10.11.2018 / 07:37
-2

Integer Type. • Table with the primitive integers of Java. Type. Size ... float (32-bit precision) and double (64-bit precision). Type ... Type String (String).

    
10.11.2018 / 07:35