Question: Java Programming. I need solutions for 13, 14. |Java-Prog X | Random num | M Inbox (3,034) L My Drive-GC MAG Slide P G communicati

Java Programming.

I need solutions for 13, 14.

Java Programming. I need solutions for 13, 14. |Java-Prog X | Random

|Java-Prog X | Random num | M Inbox (3,034) L My Drive-GC MAG Slide P G communicati 9 Effective Co Get Homewo | + O file:///C/Users/162 amming-A-Comprehensive-First -edition-1st-Ed 3. What does each object have its own copy of 4. Using two separate statements, show how to declare a variable called counter of a class called MyCounter and assign it a new object of that class. 5. Show how a method called myMeth) is declared if it has a return type of double and has two int parameters called a and b 6. How must a method return if it returns a value? 7. What name does a constructor have? 8. What does new do? 9. What is garbage collection, and how does it work? What is finalize()? 10. What is this? 11. Can a constructor have one or more parameters? 12. If a method returns no value, what must its return type be? 13. Create a Die class with one integer instance variable called sideUp. Give it a constructor and a getSideUp() method that returns the value of sideUp and a void roll) method that changes sideUp to a random value from 152 CHAPTER 4 Introducing Classes, Objects, and Methods 1 to 6. (To see how to generate a random integer between 1 and 6, look at the last exercise in Chapter 2.) Then create a DieDemo class with a main method that creates two Die objects, rolls them, and prints the sum of the two sides up. 14. Create a Card class that represents a playing card. It should have an int instance variable named rank and a char variable named suit. Give it a constructor with two parameters for initializing the two instance variables and give it a getSuit() method and a getRank) method that return the values of the two instance variables. Then create a CardTester class with a main method that creates five Cards that make up a full house (that is, three of the cards have the same rank and the other two cards have the same rank) and prints out the ranks and suits of the five Cards using the getSuit() and getRank) methods. 15. Suppose you have a class MyClass with one instance variable x. What will be printed by the following code segment? Explain your answer Mylann cl now Rylama c2.x4 System.out println(cl.x) 16. Suppose a class has an instance variable and a method with a local vi able x A. If x is used in a calculation in the body of the method, which x is being referred to? B. Suppose you needed to add the local variable to the instance variablex in the body of the method. How would you do so? 8-54 PM Type here to search 3/13/2019

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!