As we know that an abstract class can have constructors, data members, and non-abstract methods as well. This chapter will shows, how we can declare and use the Constructors in the abstract class. Important Features of Abstract Class and Methods Abstract Class An abstract class would be declared using the ‘abstract’ keyword. The creation ofRead More
The basic difference between Integer and int is that Integer is a Class whereas int is a data type. int Data Type We already know that int is a primitive data type. It means that these data types are not further breakable. Any variable declared with int data type can store only numeric values inRead More
Question: Can main method be overloaded? or Can a java program have multiple methods with name “main” keyword? Answer: Yes, the Main method can also be overloaded same as normal method overloading techniques. Method overloading is a sub-process of Polymorphism. To achieve method overloading we have to declare and define multiple methods with the same name butRead More
Question: Print Hello World as ‘Olleh Dlrow’ using Java. Problem Write a program to reverse a String or we can say that reverses each word in a sentence and also while printing the first letter should be in upper case. Input can contain any number of words as mentioned below: Input String:- Hello Worldask for helpYou Live Only OnceRead More
Problem: How to write a program that can be used for Multiplication or Division two integer values without using “*” operator and “/” or “%” operators? Example:Inputs:-6 and 3 (Multiply)50 and 10 (Multiply)18 and 2 (Divide)39 and 4 (Divide)Output:-Multiplication of 6 and 3 = 18Multiplication of 50 and 10 = 500Division of 18 and 6:Quotient 3Read More
There is a simple process to get the default value of data type. Declare data type without any value, try to access it and you will get your answer. Step-1: Declare variables Declare variables without any value and try to print the value of that variable. Step-2: Default value of data type When we tryRead More
How to split String if it contains period symbol (.) in between? Problem: I have to write a program which takes file name with any extension as a parameter and it should return the extension of that file.