Maruthi Krishna has Published 1025 Articles

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

Maruthi Krishna

Maruthi Krishna

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

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

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

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

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 are constructors in Java?

Maruthi Krishna

Maruthi Krishna

Updated on 07-Sep-2021 08:14:02

A constructor in Java is syntactically similar to methods. The difference is that the name of the constructor is same as the class name and it has no return type.You need not call a constructor it is invoked implicitly at the time of instantiation. The main purpose of a constructor ... 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

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

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

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

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

How to solve the diamond problem using default methods in Java?

Maruthi Krishna

Maruthi Krishna

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

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 ... Read More

1 2 3 4 5 ... 103 Next
Advertisements