Priority Of Thread


public class PriorityOfThread extends Thread {

  @Override
  public void run() {
    System.out.println("Child Thread running");
  }

  public static void main(String[] args) {
    //Creating a new thread
    PriorityOfThread pot = new PriorityOfThread();
    //invoking the thread
    pot.start();

    //getting current thread priority
    System.out.println(
      "main(Parent) thread Priority :" + Thread.currentThread().getPriority()
    );
    //getting new thread priority
    System.out.println("Child thread Priority" + pot.getPriority());
    //setting current thread priority
    Thread.currentThread().setPriority(10);
    //Creating another thread
    PriorityOfThread pot1 = new PriorityOfThread();
    //invoking the thread
    pot1.start();
    System.out.println("after invoking setPriority method");
    //getting current thread priority after invoking setPriority method
    System.out.println(
      "main thread priority :" + Thread.currentThread().getPriority()
    );
    //getting new created(child thread) thread priority
    //after setting priority of main thread(Parent thread)
    System.out.println("Child thread Priority :" + pot.getPriority());
    //Child inherits its  priority from its parent i.e main(in case of this thread)
    System.out.println("Second Child thread Priority :" + pot1.getPriority());
  }
}

Printing Different type of Arrays Using ForEachLoop.

 

public class ForEachLoop {

  public static void main(String[] args) {
    int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    char arr1[] = { 'a', 'b', 'c', 'd', 'e' };
    String arr2[] = { "ramkesh", "vijay", "sudeep", "Narveen", "kuldeep" };
    System.out.println(
      "---------------------------------------------------------"
    );
    //ForEachLoop to print int array
    for (int i : arr) {
      System.out.print(i + ",");
    }
    System.out.println(
      "---------------------------------------------------------"
    );
    //ForEachLoop to print  char array
    for (char c : arr1) {
      System.out.print(c + ",");
    }
    System.out.println(
      "---------------------------------------------------------"
    );
    //ForEachLoop to print String array
    for (String s : arr2) {
      System.out.print(s + ",");
    }
    System.out.println();
  }
}

Google Script for Data Entry Form in Google Spreadsheet

// function to validate the entry made by user in user form function validateEntry (){ // declare a variable and referernece of active goog...