explaination with answer please 8. Determine the output of the following Java pr
ID: 3677246 • Letter: E
Question
explaination with answer please
8. Determine the output of the following Java program consisting of the files: Itype.java, Atype.java, Btype.java and ItypeTest.java. Assume that all files are in the same directory // Itype.java interface Itype void foo) // Atype.java class Atype implements Itype public void foo ) System.out.println("in Atype's foo O") public String toString )I return "I am an Atype object" ) // Btype.java class Btype extends Atypef Btype) System.out.println ("constructing a Btype object") public void foo ) System.out.println("in Btype's foo )") h public void bar ) System.out.println("in Bytpe's bar O") public String toString )I return "I am a Btype object" // ItypeTest.java class ItypeTest public static void main(String[] args) Itype ; Atype A; Btype B; A = new Atype(); B = new Btype(); 1=A; I.foo ) A.foo B.bar System.out.println (I); System.out.println (A) System.out.println (B)Explanation / Answer
Answer 10.
import java.util.Scanner;
public class DrawSquare {
private static Scanner sca;
public static void main(String arg[])
{
sca = new Scanner(System.in);
int n=sca.nextInt();
for(int i=0;i<n;i++)
{
System.out.print("*");
}
System.out.println("");
for(int i=1;i<n-1;i++){
System.out.print("*");
for(int j=1;j<n-1;j++)
System.out.print(" ");
System.out.print("*");
System.out.println("");
}
for(int i=0;i<n;i++)
{
System.out.print("*");
}
}
}
Result:
5
*****
* *
* *
* *
*****
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.