What is printed out by the following code

Assignment Help JAVA Programming
Reference no: EM13806833

Question 1. What is printed out by the following code?

public class Inherit
{
class Figure
{
void display( )
{
System.out.println("Figure");
}
}
class Rectangle extends Figure
{
void display( )
{
System.out.println("Rectangle");
}
}
class Box extends Figure
{
void display( )
{
System.out.println("Box");
}
}
Inherit( )
{
Rectangle r = new Rectangle( );
Figure f = new Figure( );
Box b = new Box( );
r.display( );
r = f;
r.display( );
r = b;
r.display( );
}
public static void main(String[ ] args)
{
new Inherit( );
}
}

Question 2. Complete the missing code.
import java.util.Random;
public class LinearArray
{
private int[] data;
private static Random generator = new Random();

public LinearArray(int size)
{
data = new int[size];

//write the code here to fill the data (instance variable from above) array with //random integers in range 100-999
}

// write the code here to perform a linear search on the data (instance variable
// from above)
}

Reference no: EM13806833

Questions Cloud

What is a sampling distribution and how would you create one : What is a sampling distribution and how would you create one from a population? What is meant by sample proportion and sample mean? How does the concept of Central Limit Theorem apply to sampling?
What is the current price per share : Research newspaper, business magazine articles, or the Web to find computer companies whose stock is traded publicly. Choose a company and pretend to buy $1,000 of its stock. What is the current price per share
Environmental scan paper : Write a 1,050- to 1,400-word paper in which you complete the following:
What is one area that you feel is a professional strength fo : Many concepts have been covered during this class to give you an opportunity to delve into your professionalism in more depth. After reviewing the results of the survey, what is one area that you feel is a professional strength for you and one area t..
What is printed out by the following code : What is printed out by the following code
Important role in shaping individuals behavior : Organizational culture plays an important role in shaping individuals' behavior within organizations and, consequently, has a significant influence on organizational performance.  Consider the culture of an organization for which you currently or ..
Contrast the organizational transformation process : Compare and contrast the organizational transformation process presented in the previous lessons with the process of individual recruitment and radicalization outlined here. What are the primary synergies between the two
Most significant issue facing management : Write a 500-word essay on what you think is the most significant issue facing management today - and why. This may or may not be the same issue as the one you choose for your research case study; that is your choice.
What are some of benefits and limitations to using interview : What are some of the benefits and limitations to using interview as a research methodology

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd