programming in java
Harvard University
All 6 results
Sort by
-
Recursion in java
- Exam (elaborations) • 10 pages • 2023
- Available in package deal
-
- $7.99
- + learn more
Recursion 
1. What is the output of the following program? 
public class Exercise1 
{ 
public static void main(String[] args) 
{ 
cheers(3); 
} 
public static void cheers( int n) 
{ 
if (n == 1) 
{ 
Sln("Hurray"); 
} 
else 
{ 
Sln("Hip"); 
cheers(n – 1); 
} 
} 
}
-
java File I/O
- Exam (elaborations) • 11 pages • 2023
- Available in package deal
-
- $8.00
- + learn more
java File I/O 
1. A stream is a flow of data. From where and to where does the data flow in an input stream? From where and to where does the data flow in an output stream? 
2. What is the difference between a binary file and a text file? 
3. What kind of exception might be thrown by the following, and what would it 
exception is thrown? 
PrintWriter outputStream = 
new PrintWriter( new FileOutputStream("")); 
4. Does the class PrintWriter have a constructor that accepts a string (for a fi le ...
-
java Exception Handling
- Exam (elaborations) • 19 pages • 2023
- Available in package deal
-
- $8.00
- + learn more
java Exception Handling
-
exam(elaborations)Polymorphism and Abstract Classes in java
- Exam (elaborations) • 7 pages • 2023
- Available in package deal
-
- $8.00
- + learn more
1. Explain the difference between the terms late binding and polymorphism . 
2 . Suppose you modify the definitions of the class Sale ( Display 8.1 ) by adding the 
modifier final to the definition of the method bill . How would that change 
the output of the program in Display 8.3 ? 
3. Would it be legal to add the following method definition to the class 
DiscountSale ? 
public static boolean isAGoodBuy(Sale theSale) 
{ 
return (theSDiscount() > 20); 
}
-
Inheritance in java programming
- Exam (elaborations) • 12 pages • 2023
- Available in package deal
-
- $8.00
- + learn more
Inheritance 
1. Suppose the class named DiscountSale is a derived class of a class called Sale . 
Suppose the class Sale has instance variables named price and numberOfItems . 
Will an object of the class DiscountSale also have instance variables named 
price and numberOfItems ? 
2. Suppose the class named DiscountSale is a derived class of a class called Sale , 
and suppose the class Sale has public methods named getTotal and getTax . 
Will an object of the class DiscountSale have methods named...
Fear of missing out? Then don’t!
-
Exam (elaborations) programming in java
- Exam (elaborations) • 21 pages • 2023
- Available in package deal
-
- $8.00
- + learn more
Exam (elaborations) programming in java
Do you wonder why so many students wear nice clothes, have money to spare and enjoy tons of free time? Well, they sell on Stuvia! Imagine your study notes being downloaded a dozen times for $15 each. Every. Single. Day. Discover all about earning on Stuvia