Void Int: Integers Main Arguments C
Void Int: Integers Main Arguments C
class Integers {
public static void main(String[] arguments) {
int c;
//declaring a variable
/* Using for loop to
repeat instruction
execution */
for (c = 1; c <= 10; c++) {
System.out.println(c);
}
}
Output:
class Condition {
public static void main(String[] args) {
boolean learning = true;
if (learning) {
System.out.println("Java programmer");
}
else {
System.out.println("What are you doing here?");
}
Output:
class Arguments {
public static void main(String[] args) {
for (String t: args) {
System.out.println(t);
}
}
}
Practice question
Write a program to find factorial of n no.