How to declare variable in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to declare variable in java?

18th Feb 2018, 5:01 AM
Tarun Kumar Verma
Tarun Kumar Verma - avatar
2 Answers
+ 16
The first variable is of type int . A value is established in a separate Javastatement. The second variable is of type String and is declared with an initial value. Open a command prompt and navigate to the directory containing your new Java program. Eg:-) int i=10; float f=53.5; https://www.sololearn.com/learn/Java/2139/?ref=app
18th Feb 2018, 5:17 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 6
int - stores whole number String- stores sentences char- stores characters double- stores decimal numbers
18th Feb 2018, 7:08 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar