0% found this document useful (0 votes)
9 views1 page

Java Worksheet 5 Answers

Uploaded by

lokay6410
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Java Worksheet 5 Answers

Uploaded by

lokay6410
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Computer Application – Worksheet 5: Input in Java

Class 9

Name the following


1. A method to accept an exponential value through scanner object.
→ nextDouble()
2. A package needed to import scanner class.
→ [Link]
3. A package needed to import Input stream reader class.
→ [Link]
4. To accept a word “wd” through Stream class.
→ readLine()
5. To accept a character ’d’ through Scanner class.
→ next().charAt(0)
6. Name the types of errors. (a) [Link](36-45) (b) int a;b;c
→ (a) Runtime error
(b) Syntax error
7. Multi line comment is writing inside ___________.
→ /* … */
8. Scanner ab = ________ Scanner ([Link]);
→ new

Answer the following


1. What is the use of keyword ‘import’ in Java programming?
→ The `import` keyword is used to access built-in or user-defined classes from packages
into a Java program. Example: import [Link];.

2. What do you mean by ‘Run time error’?


→ A runtime error occurs while the program is executing (after successful compilation).
Example: division by zero.

3. What is a compound statement?


→ A compound statement is a group of multiple statements enclosed within { } braces,
treated as a single unit.

4. Distinguish between next() and nextLine() methods.


→ next(): Reads a single word (stops at space).
nextLine(): Reads the entire line including spaces until the Enter key is pressed.

5. Differentiate between testing and debugging.


→ Testing: The process of finding errors or bugs in the program by running it with different
inputs.
Debugging: The process of locating and fixing the errors found during testing.

You might also like