what kind of data type are these +/-/* | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

what kind of data type are these +/-/*

I wanna use +, *, - as data type like this d = +; but what kind of data type is this? should I use string or what?

25th May 2018, 7:46 AM
RH Tasin
RH Tasin - avatar
4 Respuestas
+ 7
maybe this will help? especially the calculator example at the bottom https://hashnode.com/post/anonymous-functions-in-java-explained-cj1opkbj8000sml53bsq6r6cj
25th May 2018, 8:19 AM
Burey
Burey - avatar
+ 4
You can't store operators in variables. Your best bet is to store the symbols as character or string, and then interpret them correspondingly.
25th May 2018, 7:50 AM
Hatsy Rei
Hatsy Rei - avatar
0
just announce them as strings
25th May 2018, 7:56 AM
Александр Едриванов
Александр Едриванов - avatar
0
They're not data types, they are operators. + is addition, and so on.
25th May 2018, 1:40 PM
Paul Grasser
Paul Grasser - avatar