Python Tkinter Program to Create a Window
01. Example: import tkinter as tk root = tk.Tk() root.mainloop() Output: Simple ouput window. Output: After resizing the window.
01. Example: import tkinter as tk root = tk.Tk() root.mainloop() Output: Simple ouput window. Output: After resizing the window.
01. Example: interface iAmInterface { static final String name = "Java"; public void displayData(); } class iAmClass implements iAmInterface { public static void main(String[] args) { iAmClass obj = new …
01. Example: class finallyKeywordInJava { public static void main(String[] args) { try { long number[] = new long[1000000000]; } catch (Exception e) { System.out.println(e); } finally { System.out.println("Hey, I'm finally …
01. Example: public class throwErrorExample { static void throwErrorMethod(int number) { if (number < 0){ throw new ArithmeticException("There is something wrong."); } else{ System.out.println("Check positive and negative number."); } } …
01. Example: import java.util.*; class exceptionHandling { public static void main(String[] args) { int x, y, result; Scanner input = new Scanner(System.in); System.out.print("Input two integers: "); x = input.nextInt(); y …
01. Example: class constructorOverloading { String name; constructorOverloading() { System.out.println("Hey, I'm simple constructor."); } constructorOverloading(String parameter01) { name = parameter01; System.out.println("Hey, I'm constructor with "+name+"."); } public static void main(String[] …
01. Example: class createConstructor { //constructor method createConstructor() { System.out.println("Hey, I'm constructor method."); } public static void main(String[] args) { createConstructor object = new createConstructor(); //creating object } } Output: …
01. Example: class firstClass { firstClass() { System.out.println("Constructor of first class."); } void firstClassMethod() { System.out.println("Method of first class."); } public static void main(String[] args) { firstClass firstClassObject = new …
01. Example: class DifferenceStaticAndInstanceMethod { public static void main(String[] args) { staticMethod(); // Method calling without object DifferenceStaticAndInstanceMethod obj = new DifferenceStaticAndInstanceMethod(); obj.instanceMethod(); // Method calling using object } static …
01. Example: class staticBlockExecution { public static void main(String[] args) { System.out.println("Main Method Is Executed."); } static { System.out.println("Static Block Is Executed Before Main Method."); } } Output: Static Block …