class EvenNumbersRunnable implements Runnable {
public void run() {
System.out.println("Even numbers from 1 to 50:");
for (int i = 2; i <= 50; i += 2) {
System.out.print(i + " ");
}
System.out.println(); // for a new line after printing even numbers
}
}
class VowelsRunnable implements Runnable {
public void run() {
System.out.println("Vowels in the English alphabet:");
char[] vowels = {'A', 'E', 'I', 'O', 'U'};
for (char vowel : vowels) {
System.out.print(vowel + " ");
}
System.out.println(); // for a new line after printing vowels
} }
public class RunnableExample {
public static void main(String[] args) {
// Creating Runnable objects
EvenNumbersRunnable evenRunnable = new EvenNumbersRunnable();
VowelsRunnable vowelsRunnable = new VowelsRunnable();
// Creating threads for each Runnable
Thread evenThread = new Thread(evenRunnable);
Thread vowelsThread = new Thread(vowelsRunnable);
// Starting the threads
evenThread.start();
vowelsThread.start();
}
}