An Integer in an object that represent an int (Integer a = new Integer(3) would represent 3).
I'm not sure about Real.
A String is an object that represents a word. (String a = "dog")
Boolean
String
int
int
Hope this kind of helps
Answer:
public class MagicSquare {
public static void main(String[] args) {
int[][] square = {
{ 8, 11, 14, 1},
{13, 2, 7,12},
{ 3, 16, 9, 6},
{10, 5, 4, 15}
};
System.out.printf("The square %s a magic square. %n",
(isMagicSquare(square) ? "is" : "is not"));
}
public static boolean isMagicSquare(int[][] square) {
if(square.length != square[0].length) {
return false;
}
int sum = 0;
for(int i = 0; i < square[0].length; ++i) {
sum += square[0][i];
}
int d1 = 0, d2 = 0;
for(int i = 0; i < square.length; ++i) {
int row_sum = 0;
int col_sum = 0;
for(int j = 0; j < square[0].length; ++j) {
if(i == j) {
d1 += square[i][j];
}
if(j == square.length-i-1) {
d2 += square[i][j];
}
row_sum += square[i][j];
col_sum += square[j][i];
}
if(row_sum != sum || col_sum != sum) {
return false;
}
}
return d1 == sum && d2 == sum;
}
}
A. the ability to perform a task in a short period of time using little to no energy
Answer:
Whether a traffic light is green, yellow or red
Explanation:
Boolean variables are variables that can either take one out of two options at any given instance.
Analyzing the given options
1. Elevator:
Possible Directions = Up or Down; That's two possible values
But it can only move in one direction at a given instance.
<em>This can be represented using Boolean</em>
2. Traffic Light:
Possible Lights = Green, Yellow or Red
That's three options.
<em>This can be represented using Boolean</em>
<em />
The last two options can be represented using Boolean because they have just two possible values
<em>Hence, option (B) answers the question</em>