Maruthi Krishna has Published 951 Articles

How to host a web-service using IIS (windows) and .net

Maruthi Krishna

Maruthi Krishna

Updated on 12-Feb-2021 11:11:22

4K+ Views

A web service is any piece of software which offers service to other systems. It makes itself available over the internet and uses a standardized XML or, JSON messaging system. A web service enables communication among various applications by using open standards such as HTML, XML, WSDL, and SOAP.IISIIS stands ... Read More

Can we override default methods in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 12:42:05

6K+ Views

An interface in Java is similar to class but, it contains only abstract methods and fields which are final and static.Since Java8 static methods and default methods are introduced in interfaces. Unlike other abstract methods these are the methods can have a default implementation. If you have default method in ... Read More

How to solve diamond problem using default methods in Java

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:53:31

11K+ Views

Inheritance is a relation between two classes where one class inherits the properties of the other class. This relation can be defined using the extends keyword as −public class A extends B{}The class which inherits the properties is known as sub class or, child class and the class whose properties are ... Read More

How to convert a super class variable into a sub class type in Java

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:52:56

9K+ Views

Inheritance is a relation between two classes where one class inherits the properties of the other class. This relation can be defined using the extends keyword as −public class A extends B{}The class which inherits the properties is known as sub class or, child class and the class whose properties are ... Read More

How to convert a sub class variable into a super class type in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:52:37

1K+ Views

Inheritance is a relation between two classes where one class inherits the properties of the other class. This relation can be defined using the extends keyword as −public class A extends B{}The class which inherits the properties is known as sub class or, child class and the class whose properties are ... Read More

Explain the usage of the valueOf() method of the String class in Java

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:36:43

117 Views

The String class of the java.lang package represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. Strings are constant, their values cannot be changed after they are created.The valueOf() method of the String class accepts a char or, char array ... Read More

How to convert a double value into a Java String using append method?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:36:26

190 Views

The append method of the StringBuilder or StringBuffer objects accept a boolean or, char or, char array or, double or, float or, int or, long or, String value as parameter and adds it to the current object.You can append the required double value to the method and retrieve a String from obtained StringBuffer ... Read More

Can we define an enum inside a method in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:35:52

2K+ Views

Enumerations in Java represents a group of named constants, you can create an enumeration using the following syntax −enum Days {    SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }We can an enumeration inside a class. But, we cannot define an enum inside a method. If you try to do ... Read More

Can we define an enum inside a class in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:34:06

14K+ Views

Enumerations in Java represents a group of named constants, you can create an enumeration using the following syntaxenum Days {    SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }Yes, we can define an enumeration inside a class. You can retrieve the values in an enumeration using the values() method.ExampleLive Demopublic class ... Read More

How to handle IllegalArgumentException inside an if using Java

Maruthi Krishna

Maruthi Krishna

Updated on 08-Feb-2021 11:30:06

475 Views

While you use the methods that causes IllegalArgumentException, since you know the legal arguments of them, you can restrict/validate the arguments using if-condition before-hand and avoid the exception.We can restrict the argument value of a method using the if statement. For example, if a method accepts values of certain range, ... Read More

Advertisements