Illustrate I1 = new Illustrate(3);
public Illustrate(int a)
{
x=a;
}
The value of x is 3
Illustrate.incrementY();
public static void incrementY()
{
y++; // y value is incremented by 1 so y=1
}
Illustrate.count++;
public static int count=0;
Now count++ = 1;
Option 3
Please Explain, Thanks :) QUESTION 2 Ghen is a java class าน¡strate, what are the contents...
QUESTION 7 10 points Save Answer Given is a java class 'lustrate'. What are the contents of the object 13 right after line 13 in the main method? publie class Illustrate publie atatie void main (Stringl argo private int x private static int y 0; public statie int count-0 public Illustrate0) 1. Illustrate 11 -new 1llustrate(3) 2. Illustrate 12·new Illustrate(5); Illustrate.incrementy public Illustrate(int a) 9. Illustrate.count 10 public Illustrate(Illustrate I) 12 13. Illustrate 13·new Illustrate(11); 14 15. Illustrate 14-13; 16....
output
What is the output of the following: class Access public int x; private int y public void cal(int x, int y) { this.x = x + 1; this.y = y; } public void print() { System.out.print(""+y); } } class AccessSpecifier { public static void main(String args[]) { Access obj = new Access(); obj.cal(2, 3); System.out.print(obj.x); obj.print(); } } 33 Compilation error 23 None of the available choices Runtime error
Question 28 public class Main public static void main(String args[]) { Iparentp=new Child (1.2); p.printo: interface Iparent public int x = 1; public void printo: class Child implements Iparent private int y public Child(int a, int b) y b: public void printot System.out.print("Child"-yl: Child 2 public int x = 1; public void print(); class Child implements Iparent! private int y public Child(int a, in lb) y=b; public vold print! System.out.pnt("Child"+y): Child 2 1 None of the above • Previous
I need help with my java code i am having a hard time compiling it // Cristian Benitez import java.awt.Color; import java.awt.Graphics; import java.util.ArrayList; import javax.swing.JPanel; Face class public class FaceDraw{ int width; int height; int x; int y; String smileStatus; //default constructor public FaceDraw(){ } // Getters and Setters for width,height,x,y public int getWidth(){ return width; } public void setWidth(int width){ this.width=width; } public int getHeight(){ return height; } public void setHeight(int height){ this.height=height; } public int getX(){ return...
(JAVA NetBeans)
Write programs in java
Example 10.21-24
//Animal.java
/** Animal class
* Anderson. Franceschi
*/
import java.awt.Graphics;
public abstract class Animal
{
private int x; // x position
private int y; // y position
private String ID; // animal ID
/** default constructor
* Sets ID to empty String
*/
public Animal( )
{
ID = "";
}
/** Constructor
* @param rID Animal ID
* @param rX x position
* @param rY y position
*/
public Animal( String...
please evaluate the following code. this is JAVA a. class Car { public int i = 3; public Car(int i) { this.i = i; } } ... Car x = new Car(7), y = new Car(5); x = y; y.i = 9; System.out.println(x.i); b. class Driver { public static void main(String[] args) { int[] x = {5, 2, 3, 6, 5}; int n = x.length; for (int j = n-2; j > 0; j--) x[j] = x[j-1]; for (int j...
1) Consider the following Java program: 1 public class HelloWorld { 2 // My first program! 3 public static void main(String[] args) { 4 System.out.println("Hello, World!"); 5 } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...
In Java Swing, in my ButtonHandler class, I need to have 2 different showDialog messages show when my acceptbutton1 is pressed. One message is if the mouse HAS been dragged. One is if the mouse HAS NOT been dragged. /// I tried to make the Points class or the Mouse Dragged function return a boolean of true, so that I could construct an IF/THEN statement for the showDialog messages, but my boolean value was never accepted by ButtonHandler. *************************ButtonHandler class************************************...
JAVA 1. Given the following class definition, what are the contents of the fields x and y of the object p ? class MyPoint { int x; int y; public MyPoint (int x, int y){ x = x; y = y; } --------------------------------------- MyPoint p = new MyPoint( 100, 88 ); 2. static and non-static members What would happen if you tried to compile and run the following code ? public class Driver {...
Computer Science - Java
Explain the code step by step (in detailed order). Also explain
what the program required. Thanks
7 import java.io.File; 8 import java.util.Scanner; 9 import java.util.Arrays; 10 import java.io.FileNotFoundException; 12 public class insertionSort 13 14 public static void insertionSort (double array]) 15 int n -array.length; for (int j-1; j < n; j++) 17 18 19 20 21 double key - array[j]; int i-_1 while ( (i > -1) && ( array [i] > key array [i+1] -...