Write a program to declare the variable zeroIntegerand initialize with value 0. You have to print the variable zeroInteger.
Keep the name of your class as Main
Use the System.out.println()statement for printing.
Example output: 0
Answers
Answered by
6
public class Main{
public static void main(String...args){
int zeroInteger=0;
System.out.println(zeroInteger);
}
}
public static void main(String...args){
int zeroInteger=0;
System.out.println(zeroInteger);
}
}
Answered by
0
Here's one way you could write a program in Java to declare and initialize the variable zeroInteger with the value 0, and print its value:
class Main {
public static void main(String[] args) {
int zeroInteger = 0;
System.out.println(zeroInteger);
}
}
- The program starts with the declaration of the class named "Main".
- Inside the class, we have the main method, where the program execution starts.
- Inside the main method, we declare a variable zeroInteger of type int and initialize it with the value 0.
- Next we use the System.out.println() function to print the value of variable zeroInteger which is 0 .
- The program ends with closing the main method and class.
- When you run this program, it will output 0 as the value of variable zeroInteger.
To learn more about javascript from the given link.
https://brainly.in/question/2216118
#SPJ3
Similar questions