Answer:
class Main {
public static void main(String[] args) {
System.out.println(" _");
System.out.println(" / \\");
System.out.println("| |");
System.out.println(" \\ _ /");
}
}
Explanation:
Backslashes have a special meaning in string literals. You have to escape them with a backslash, hence the double backslash.
docx
Office Open XML (OOXML) format was introduced with Microsoft Office 2007 and became the default format of Microsoft Word ever since. Pertaining file extensions include: .docx – Word document. .docm – Word macro-enabled document; same as docx, but may contain macros and scripts.
Answer:
Kindly check attached picture
Explanation:
Flowchart gives a graphical representation of a steps taken towers the execution of a program.
In the flowchart attached, A variable was initialized and set to 0 ; then a for loop was used to iterate integers 1 up to 10, for each number. It is added to the initialized variable sum until all the 10 integer numbers are added. The the average is obtained by dividing by 10.
The switch statement is an n-way branch. An n-way branch can branch to any of an arbitrary number ( n ) of branches. An if statement can branch two ways, whether the condition is true or false.
The example you gave is a great example of how how code is written can make the code make sense or not.
public void setQuiz( int quiz, int grade )
{
switch( quiz )
{
case 1: // if quiz == 1
grade1 = grade; //where was grade1 declared?
break; // otherwise execution will continue through the next case block
case 2: // if quiz == 2
grade2 = grade;
break;
}
}
The variable named in the switch statement is tested against each case statement and whichever case statement's value matches, the rest of the switch statement's code is executed. (That's why the break statements are needed) Usually switch statements are written with a default case at the end as a "catchall".