We solemnly publish and declare these variables...

  • 1
  • Locked
In Java, variables must be declared, i.e. we must allocate space for a specific variable type. Only after we have done this can we assign a specific value. It's nice that we can do this literally in one line. In this task, you have to declare several variables and immediately assign them values.
You can't complete this task, because you're not signed in.
Comments (92)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
sreeju
Level 2 , Bengaluru, India
21 May, 04:02
public class Main{
      public static void main(String args[]){
                int a = 1, b = 2;
      }
}
L01954
Level 1 , Netherlands
15 March, 11:13
int a = 10; int b = 5;
Tanishka Ashwarya
Level 2 , Bangalore, India
13 March, 05:06
import java.util*; public class tanishka { public static void main (strin[]args) { int a=7; int b=2; } }
Allan Gilbert
Level 3 , CodeGym University in India, India
Expert
9 February, 14:58
public class Solution { public static void main(String[] args) { int a = 10; int b = 5;
phuminis35
Level 1 , Angeles, Philippines
11 January, 10:42
public class Solution { public static void main(String[] args) { int a = 10; int b = 5; } }
Kenjie Aguila
Level 2 , Norway
30 December 2022, 09:52
when you declare more than one(1) int variable on your code, might as well try playing with it. You can use simple math operations such as: +, -, /, and *. If you want to have an output where you want to add your two variables together you can use the command "System.out.println(a + b);" after you declare your int variables.
Dieme Kalombo
Level 1 , Canada
21 December 2022, 18:31
Answer: public class Solution { public static void main(String[] args) { int a = 5, b = 12; } }
Anonymous #11209850
Level 1 , Bainbridge Island, United States
14 December 2022, 04:12
for whatever reason the compiler doesn't consider my ";" to be ";" indeed...but only every other time...odd
Anonymous #11214744
Level 1 , Georgia
12 December 2022, 11:51
guys just click hint and then click verify
Gulfam Khan
Level 1 , India
4 November 2022, 18:23
int a = 10; int b = 20; int sum = a+b; System.out.printl(sum);