Translates Java Source Code to Byte Code

Added on - 21 Apr 2020

  • 6


  • 864


  • 25


  • 0


Showing pages 1 to 3 of 6 pages
Section A. Multiple Choice QuestionsQuestion No.Answer choiceAnswer1CPlatform-independent2Da and b3Eencapsulation4DProduct Quality with less defects5CHuman user to system interaction6DGlobal variables7AReal world entity8ENone of theabove9BVerify the project purpose10BJunit11ABlock, line and javadoc12BTranslates java source code to bytecode13EA class can extend one class andimplement many interfaces14AVoid15DWon't compile because of line (5),constructor can't be static16DCompilation Error17AMethod 118BHellow19Cjavafx.scene.layout.BorderPane20Cwhenever the pane is resized, therectangle will move to the centre of thepane21Conetwo
Section B. Short Answer QuestionsQ 22.This is a simple implementation of Shape interface to make a Square class.This class has a private member side that is getting initialized through a parameterizedconstructor.If this side length is less then or equal to 0, then it throws anIllegalArgumentExceptionA square has 4 sides ,sointnumberOfSides() returns 4.getPerimeter() function returns 4* side as the perimeter of a square is4* its side.getArea() return side * side as its area.publicclassSquareimplementsShape {/*** side of the square*/privatedoubleside;/*** Initializes the side of the square*@paramside side of the square*/publicSquare(doubleside){if(side<=0)thrownewIllegalArgumentException ();this.side=side;}@OverridepublicintnumberOfSides() {return4;}@OverridepublicdoublegetPerimeter() {return4*side;}@OverridepublicdoublegetArea() {returnside*side;}}
You’re reading a preview

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Download This Document