Maruthi Krishna has Published 952 Articles

How to Sort a String in Java alphabetically in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 02-Sep-2023 10:27:00

70K+ Views

Using the toCharArray() methodThe toCharArray() method of this class converts the String to a character array and returns it. To sort a string value alphabetically −Get the required string.Convert the given string to a character array using the toCharArray() method.Sort the obtained array using the sort() method of the Arrays ... Read More

Difference between peek(), poll() and remove() method of Queue interface in java?

Maruthi Krishna

Maruthi Krishna

Updated on 06-May-2022 07:40:42

10K+ Views

This represents a collection that is indented to hold data before processing. It is an arrangement of the type First-In-First-Out (FIFO). The first element put in the queue is the first element taken out from it.The peek() methodThe peek() method returns the object at the top of the current queue, ... Read More

How to add an image as label using JavaFX?

Maruthi Krishna

Maruthi Krishna

Updated on 19-Apr-2022 15:35:29

2K+ Views

You can display a text element/image on the User Interface using the Label component. It is a not editable text control, mostly used to specify the purpose of other nodes in the application.In JavaFX you can create a label by instantiating the javafx.scene.control.Label class. To create a label, you need ... Read More

Can we declare interface members as private or protected in java8?

Maruthi Krishna

Maruthi Krishna

Updated on 04-Feb-2022 06:05:47

4K+ Views

Interface in Java is similar to a class but, it contains only abstract methods and fields which are final and static.Since all the methods are abstract you cannot instantiate it. To use it, you need to implement this interface using a class and provide body to all the abstract methods ... Read More

How to get (format) date and time from mill seconds in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 07-Sep-2021 13:12:20

2K+ Views

The java.text.SimpleDateFormat class is used to format and parse a string to date and date to string.One of the constructors of this class accepts a String value representing the desired date format and creates SimpleDateFormat object.To format milli seconds to date −Create the format string as dd MMM yyyy HH:mm:ss:SSS Z.The ... Read More

What happens if we try to extend a final class in java?

Maruthi Krishna

Maruthi Krishna

Updated on 29-Jul-2021 14:12:54

2K+ Views

In Java final is the access modifier which can be used with a filed class and a method.When a method if final it cannot be overridden.When a variable is final its value cannot be modified further.When a class is finale it cannot be extended.Extending a final classWhen we try to ... Read More

Why can't we use the "super" keyword is in a static method in java?

Maruthi Krishna

Maruthi Krishna

Updated on 28-Jul-2021 14:43:59

3K+ Views

A static method or, block belongs to the class and these will be loaded into the memory along with the class. You can invoke static methods without creating an object. (using the class name as reference).Where the "super" keyword in Java is used as a reference to the object of ... Read More

How to create a Dialog in JavaFX?

Maruthi Krishna

Maruthi Krishna

Updated on 04-Jun-2021 06:10:21

7K+ Views

A Dialog is a graphical element, a window that shows information to the window and receives a response. You can create a dialog by instantiating the javafx.scene.control.Dialog class.ExampleThe following Example demonstrates the creation of a Dialog.import javafx.application.Application; import javafx.geometry.Insets; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; import ... Read More

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

Advertisements