Here this example demonstrates how to show the confirm dialog in Java.
Source Code
package com.beginner.examples;
import javax.swing.JOptionPane;
public class ConfirmDialogExample {
public static void main(String[] args){
int m = JOptionPane.showConfirmDialog(null, "Are you ok?");
//System.out.println(m);
System.out.println("Done!");
}
}
Output:
Done!
References
Imported packages in Java documentation: