Java | JSP | JSF Answers

Questions answered by Experts: 3 611

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Evaluate the JAVA code snippet below, then motivate why this is representative of good programming practices or not.
public class pattern{ public static void main(string[] args){ int rows = 5; for(int i = 1; i <= rows; ++i){ for(int j=1;j<=I;++j){ system.out.print(“*”); } System.out.println(); } }

Give an example of a class and an example of an object. Describe what a class is, what an object is, and how they are related. Use your examples to illustrate the descriptions.


Write a Java program that displays at least four lines of your favorite song. Name the class as FavoriteSong.java and add meaningful comment to the class.
Give an example of a while loop, then provide the equivalent do-while loop and for loop. Then give a different example of a do-while loop, along with the equivalent while loop and for loop. Finally, give an example of a for loop, along with the equivalent while loop and do-while loop. Use your examples to illustrate the advantages and disadvantages of each looping structure, and describe those advantages and disadvantages.

Create an class called Book the following attributes

 like,

    book_id as integer

    book_name as String

    book_price as double

    book_write as String



  create another class called BookBO

 which consist one field two methods like

Book[] book


i)public void setBook(Book[] book)


ii)public Book[] getBook()  


iii)public boolean searchBook(int bookid)


create another class called Main to access all other class to save and extract the information of 5 books.


Consider the following interface definition that is written without methods. Instead, it has comments followed by blank areas denoted by …………… to describe what each method has to
do. Add method definitions in those blank areas as indicated in the comment. Check exceptions
also.
public interface Quiz {
findQuiz (id) // Return the specific quiz
startQuiz(id) checkSoultions( ) //shows solutions of the quiz questions
getResult( ) //information about correct, incorrect answers, show score }
What are wrapper classes and why are they useful for ArrayLists? In your answer, include examples of autoboxing and unboxing.
Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners.
What are wrapper classes and why are they useful for ArrayLists? In your answer, include examples of autoboxing and unboxing.
Give examples showing how "super" and "this" are useful with inheritance in Java. Include examples of using "super" and "this" both as constructors and as variables.
LATEST TUTORIALS
APPROVED BY CLIENTS