please explain this program and tell the out put of this program..
// Classname must be same as filename.
public class test
{
// Variables
private static String myText = "Hello, World";
private static String msg;
private static int myInt = 10;
// Main - Where the Action Starts
public static void main(String args[])
{
// Print "Hello, World" to the screen.
System.out.prin tln("Hello, World\n");
// Multiplication for each value
for (int i = 0; i <10; i++)
{
// Print Calculations to Screen
System.out.prin tln(calc(i));
}
}
// Handle the calculations
public static String calc(int timesBy)
{
// Put calculation into string
msg = myInt + " x " + timesBy + "= " + (myInt * timesBy) + "\n";
// Return Calculation
return msg;
}
}
// Classname must be same as filename.
public class test
{
// Variables
private static String myText = "Hello, World";
private static String msg;
private static int myInt = 10;
// Main - Where the Action Starts
public static void main(String args[])
{
// Print "Hello, World" to the screen.
System.out.prin tln("Hello, World\n");
// Multiplication for each value
for (int i = 0; i <10; i++)
{
// Print Calculations to Screen
System.out.prin tln(calc(i));
}
}
// Handle the calculations
public static String calc(int timesBy)
{
// Put calculation into string
msg = myInt + " x " + timesBy + "= " + (myInt * timesBy) + "\n";
// Return Calculation
return msg;
}
}
Comment