P2Cart Logo
Accept a string and count the number of vowels present in the string

This Java program counts the number of vowels in a user-provided string. It efficiently iterates through each character of the input and checks for vowel occurrences, displaying the total count at the end.

Read more
Write a program in Java to accept a string and count the number of vowels present in the string
Sample Input: Rajendra Vidyalaya
Sample Output: The number of vowels = 7

Read Answer
Write a program to display the given pattern. B L U E J, L U E J B, U E J B L, E J B L U, J B L U E

Here’s a Java program that displays the specified pattern where the letters of the word "BLUEJ" rotate in a circular manner across each line:

Read more
Write a program to display the given pattern.
B L U E J
L U E J B
U E J B L
E J B L U
J B L U E

Read Answer
Write a program to display the given pattern. B, B L, B L U, B L U E, B L U E J

This Java program uses nested loops to print the letters of the word "BLUEJ" in a triangular pattern. Each row adds one more letter, creating a visually structured output. It serves as a basic example of string manipulation and loop control in Java.

Read more
Write a program to display the given pattern.
B
B L
B L U       
B L U E
B L U E J

Read Answer
Write a program in Java to display the given pattern B L U E J

Here’s a Java program to display the given pattern of letters and a list of relevant meta tags for better understanding and categorization.

Read more
Write a program in Java to display the given pattern
B
L
U
E
J
Read Answer
Write a program to enter an alphabet.

Here's a Java program that accepts an alphabet, changes its case, and displays the new character along with its ASCII value:

Read more
Write a program to enter an alphabet. Display the new alphabet and its ASCII code after changing the case.
Sample Input: b
Sample Output: B
                             The ASCII value of B is 98

Read Answer
Write a program in Java to accept a character and check the case (upper/lower) otherwise check whether it is a digit or a special character.

This program accepts a character and checks if it is an uppercase or lowercase letter, a digit, or a special character.

Read more
Write a program in Java to accept a character and check the case (upper/lower) otherwise check whether it is a digit or a special character.
Sample input: Enter a character H
Sample Output: H is an upper-case letter
Read Answer
What is exception?

An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions. In Java, exceptions are objects that represent errors or unexpected behavior. They can occur due to various reasons, such as:

Read more
What is an exception? Name two exception-handling blocks.
Read Answer
What is the use of Excepting Handling in Java?

Exception handling in Java is a mechanism that provides a way to handle errors and exceptions gracefully without crashing the program. It allows developers to manage runtime errors and maintain the normal flow of application execution. Here are some key uses:

Read more
What is the use of Excepting Handling in Java?
Read Answer
Name the following: a) A package that is involved to manipulate characters as well as Strings. b) String variable to store a decimal fraction 0.732 as a String.

A package that is involved to manipulate characters as well as Strings. Answer: java.lang The java.lang package includes classes like String, StringBuilder, StringBuffer, and Character, which are used for character and string manipulation. This package is imported by default in all Java programs.

Read more
     Name the following:
a)      A package that is involved in manipulating characters as well as Strings.
b)      String variable to store a decimal fraction 0.732 as a String.

Read Answer
Write a statement for each of the following: a) To store a number 275 as a String. b) Convert the String to a numeric type value. c) Add it to the existing total of 1000 to update the total.

Learn how to store a numeric value as a String, convert it to an integer, and add it to an existing total in Java through practical examples.

Read more
     Write a statement for each of the following:
a)      To store a number 275 as a String.
b)      Convert the String to a numeric type value.
c)      Add it to the existing total of 1000 to update the total.

Read Answer
Name the class that is used for the different mathematical functions.

Discover how to use Java's Math class for mathematical functions with examples like Math.sqrt() for calculating square roots.

Read more

Name the class that is used for the different mathematical functions. Give an example of a Mathematical function.

Read Answer
Name the following: a) A package that is involved by default. b) A keyboard, to use the classes defined in a package. c) It indicates that an error has occurred in input/output operation.

Learn about Java's default package (java.lang), the import keyword for accessing classes within packages, and IOException for handling input/output errors. This guide provides quick answers to essential Java programming concepts.

Read more
     Name the following:
a)      A package that is involved by default.
b)      A keyboard, to use the classes defined in a package.
c)      It indicates that an error has occurred in input/output operation.

Read Answer
You are given a package RESULT marks.

This guide covers how to import a Java package named RESULT and access a class, variable, or method such as Eng. It includes the syntax for importing and using a package in Java, with a code example.

Read more

You are given a package of RESULT marks. How will you import this package to use Eng? Give syntax.

Read Answer
Write down the advantage of exception handling?

Exception handling in Java provides a structured way to detect and manage runtime errors, allowing the program to continue running smoothly or to terminate gracefully, rather than crashing unexpectedly. By using exception handling, developers can anticipate potential errors and handle them effectively. Here are some key advantages:

Read more

Write down the advantages of exception handling.

Read Answer
What is a package?

In Java, a package is a namespace that organizes a set of related classes and interfaces. Conceptually similar to directories on your computer, packages help in avoiding name clashes and controlling access with access modifiers. They also make it easier to locate and use classes, interfaces, and sub-packages.

Read more
What is a package? Give an example.
Read Answer
What is a wrapper class?

In Java, a wrapper class is a class that encapsulates (or "wraps") a primitive data type into an object. This allows primitive types (like int, char, double, etc.) to be treated as objects, which is essential when using Java's collections framework and other object-oriented features. Each primitive type has a corresponding wrapper class defined in the java.lang package.

Read more
What is a wrapper class? Give two examples.
Read Answer
In what way throws I/O exception is capable to eliminate probable I/O error?

In Java, the throws keyword is used in method signatures to declare that a method may throw certain types of exceptions, including I/O exceptions. This feature allows developers to handle potential input/output (I/O) errors effectively. Here’s how using throws IOException can help in managing I/O errors:

Read more
In what way throws I/O exception is capable to eliminate probable I/O error?
Read Answer
Write down the purpose of using try {} and catch {} keyboards.

The try and catch keywords in Java are fundamental components of exception handling. They serve the purpose of managing and responding to runtime errors in a controlled manner. Here's a breakdown of their purposes:

Read more

Write down the purpose of using try {} and catch {} keyboards.

Read Answer
What do you mean by exception handing?

Exception Handling is a mechanism in programming that allows developers to manage and respond to runtime errors or exceptional conditions that occur during the execution of a program. Instead of the program crashing when an error occurs, exception handling provides a way to gracefully handle the error, allowing the program to continue running or to fail in a controlled manner.

Read more

What do you mean by exception handling? How it can be done in a Java system?

Read Answer
Mention different I/O streams used in Java programming.

In Java, input and output (I/O) operations are primarily handled through streams. Java provides a variety of I/O streams to work with different data types, sources, and destinations. Here are the different types of I/O streams used in Java programming

Read more
Mention different I/O streams used in Java programming. 
Read Answer