Pack
programming in java questions and answers 2023/2024
programming in java questions and answers 2023/2024 the document contains over 450 questions and 100% accurate answers
[Montrer plus]programming in java questions and answers 2023/2024 the document contains over 450 questions and 100% accurate answers
[Montrer plus]36 JAVA QUESTIONS AND 100% ACCURATE ANSWERS 
1. If the following statement were used in a Java program, it would cause something to be written to the screen. What would it cause to be written to the screen? 
Sln("Java is not a drink."); 
2. Give a statement or statements that can be used in a Java...
Aperçu 2 sur 10 pages
Ajouter au panier36 JAVA QUESTIONS AND 100% ACCURATE ANSWERS 
1. If the following statement were used in a Java program, it would cause something to be written to the screen. What would it cause to be written to the screen? 
Sln("Java is not a drink."); 
2. Give a statement or statements that can be used in a Java...
1. 	What output is produced by the following lines? 
String s = "Hello" + "Joe"; 
Sln(s); 
2. 	Write Java statements that will cause the following to be written to the screen: 
One two buckle your shoe. 
Three four shut the door. 
3.	 What is the difference between Sln and S ? 
4.	 What is the o...
Aperçu 2 sur 9 pages
Ajouter au panier1. 	What output is produced by the following lines? 
String s = "Hello" + "Joe"; 
Sln(s); 
2. 	Write Java statements that will cause the following to be written to the screen: 
One two buckle your shoe. 
Three four shut the door. 
3.	 What is the difference between Sln and S ? 
4.	 What is the o...
Aperçu 3 sur 21 pages
Ajouter au panierExam (elaborations) programming in java
Aperçu 4 sur 43 pages
Ajouter au panierExam (elaborations) java
1. In the array declaration 
String[] word = new String[5]; 
what is 
a. the array name? 
b. the base type? 
c. the length of the array? 
d. the range of values an index accessing this array can have? 
e. one of the indexed variables (or elements) of this array? 
2. In the array 
double [] score = n...
Aperçu 3 sur 23 pages
Ajouter au panier1. In the array declaration 
String[] word = new String[5]; 
what is 
a. the array name? 
b. the base type? 
c. the length of the array? 
d. the range of values an index accessing this array can have? 
e. one of the indexed variables (or elements) of this array? 
2. In the array 
double [] score = n...
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 clas...
Aperçu 2 sur 12 pages
Ajouter au panierInheritance 
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 clas...
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...
Aperçu 2 sur 7 pages
Ajouter au panier1. 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...
Aperçu 3 sur 19 pages
Ajouter au panierjava Exception Handling
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, ...
Aperçu 2 sur 11 pages
Ajouter au panierjava 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, ...
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); 
} 
} 
}
Aperçu 2 sur 10 pages
Ajouter au panierRecursion 
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); 
} 
} 
}
Exam (elaborations) UML and Patterns in java
Aperçu 2 sur 10 pages
Ajouter au panierExam (elaborations) UML and Patterns in java
1.Can you have a variable of an interface type? Can you have a parameter of an 
interface type? 
2. Can an abstract class ever implement an interface? 
3. Can a derived class have two base classes? Can it implement two interfaces? 
4. Can an interface implement another interface?
Aperçu 2 sur 15 pages
Ajouter au panier1.Can you have a variable of an interface type? Can you have a parameter of an 
interface type? 
2. Can an abstract class ever implement an interface? 
3. Can a derived class have two base classes? Can it implement two interfaces? 
4. Can an interface implement another interface?
Generics and the ArrayList Class in java 
1. Suppose list is an object of the class ArrayList<String> . How do you add 
the string "Hello" to the ArrayList list ? 
2. Suppose instruction is an object of the class ArrayList<String> that contains 
the string "Stop" at index position 5 ...
Aperçu 2 sur 9 pages
Ajouter au panierGenerics and the ArrayList Class in java 
1. Suppose list is an object of the class ArrayList<String> . How do you add 
the string "Hello" to the ArrayList list ? 
2. Suppose instruction is an object of the class ArrayList<String> that contains 
the string "Stop" at index position 5 ...
Linked Data Structures 
1. What output is produced by the following code? 
LinkedList1 list = new LinkedList1( ); 
ToStart("apple pie", 1); 
ToStart("hot dogs", 12); 
ToStart("mustard", 1); 
tList( );
Aperçu 2 sur 12 pages
Ajouter au panierLinked Data Structures 
1. What output is produced by the following code? 
LinkedList1 list = new LinkedList1( ); 
ToStart("apple pie", 1); 
ToStart("hot dogs", 12); 
ToStart("mustard", 1); 
tList( );
1. Give the definition of a boolean valued static generic method named inSome . 
The method inSome has two parameters of type Collection<T> and one 
parameter of type T . The method returns true if the parameter of type T is in 
either (or both) collections; it returns false otherwise. 
2. Giv...
Aperçu 1 sur 4 pages
Ajouter au panier1. Give the definition of a boolean valued static generic method named inSome . 
The method inSome has two parameters of type Collection<T> and one 
parameter of type T . The method returns true if the parameter of type T is in 
either (or both) collections; it returns false otherwise. 
2. Giv...
1. What Swing class do you normally use to define a window? Any window class 
that you define would normally be an object of this class.
Aperçu 3 sur 22 pages
Ajouter au panier1. What Swing class do you normally use to define a window? Any window class 
that you define would normally be an object of this class.
1. Because sleep is a static method, how can it possibly know what thread it needs 
to pause? 
4. Here is some code that synchronizes thread access to a shared variable. How 
come it is not guaranteed to output 30,000 every time it is run? 
public class Counter 
{ 
private int counter; 
public Count...
Aperçu 2 sur 6 pages
Ajouter au panier1. Because sleep is a static method, how can it possibly know what thread it needs 
to pause? 
4. Here is some code that synchronizes thread access to a shared variable. How 
come it is not guaranteed to output 30,000 every time it is run? 
public class Counter 
{ 
private int counter; 
public Count...
Exam (elaborations) java Applets and HTML 
1. When a browser displays text from an HTML document, where does the browser 
put the line breaks? Does it leave them where they are in the HTML document? 
Does it insert a line break after every 80 characters? Or does it do something else? 
2. What is th...
Aperçu 2 sur 6 pages
Ajouter au panierExam (elaborations) java Applets and HTML 
1. When a browser displays text from an HTML document, where does the browser 
put the line breaks? Does it leave them where they are in the HTML document? 
Does it insert a line break after every 80 characters? Or does it do something else? 
2. What is th...
Les clients de Stuvia ont évalués plus de 700 000 résumés. C'est comme ça que vous savez que vous achetez les meilleurs documents.
Vous pouvez payer rapidement avec iDeal, carte de crédit ou Stuvia-crédit pour les résumés. Il n'y a pas d'adhésion nécessaire.
Vos camarades écrivent eux-mêmes les notes d’étude, c’est pourquoi les documents sont toujours fiables et à jour. Cela garantit que vous arrivez rapidement au coeur du matériel.
Vous obtenez un PDF, disponible immédiatement après votre achat. Le document acheté est accessible à tout moment, n'importe où et indéfiniment via votre profil.
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Stuvia est une place de marché. Alors, vous n'achetez donc pas ce document chez nous, mais auprès du vendeur codersimon. Stuvia facilite les paiements au vendeur.
Non, vous n'achetez ce résumé que pour $27.00. Vous n'êtes lié à rien après votre achat.
4.6 étoiles sur Google & Trustpilot (+1000 avis)
89675 résumés ont été vendus ces 30 derniers jours
Fondée en 2010, la référence pour acheter des résumés depuis déjà 14 ans