This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Runnable; | |
import java.lang.*; | |
import java.util.HashSet; | |
import java.util.Set; | |
import java.util.concurrent.*; | |
public class ExecutorServiceExample { | |
public static void main(String[] args) throws InterruptedException, ExecutionException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Runnable; | |
import java.lang.*; | |
import java.util.HashSet; | |
import java.util.Set; | |
import java.util.concurrent.*; | |
public class ExecutorServiceExample { | |
public static void main(String[] args) throws InterruptedException, ExecutionException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Runnable; | |
import java.lang.*; | |
import java.util.concurrent.*; | |
// assigning a task to ExecutorService using submit() method | |
public class ExecutorServiceExample { | |
public static void main(String[] args) { | |
ExecutorService executorService = Executors.newSingleThreadExecutor(); | |
executorService.submit(new Runnable() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import javax.naming.Context; | |
import java.lang.Thread; | |
import java.lang.Runnable; | |
import java.lang.*; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
// assigning a task to ExecutorService using execute() method | |
public class ExecutorServiceExample { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Thread; | |
import java.lang.Runnable; | |
import java.lang.*; | |
// illustrating the use of Java ThreadLocal initialValue() method | |
class NewThread extends Thread { | |
private static ThreadLocal anjali = new ThreadLocal(){ | |
protected Object initialValue(){ | |
return new Integer(a--); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Thread; | |
import java.lang.Runnable; | |
import java.lang.*; | |
// illustrating the use of get(), set(), and remove() ThreadLocal methods | |
class ThreadLocalExp { | |
public static void main(String[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Thread; | |
import java.lang.Runnable; | |
import java.lang.*; | |
class ThreadLocalExp | |
{ | |
public static class MyRunnable implements Runnable | |
{ | |
private ThreadLocal<Integer> threadLocal = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Thread; | |
import java.lang.Runnable; | |
class MultithreadingDemo implements Runnable { | |
public void run(){ | |
try { | |
System.out.println("Thread"+ Thread.currentThread().getId()+" is running"); | |
} | |
catch(Exception e){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wordpress.compilationerrors; | |
import java.lang.Thread; | |
class MultithreadingDemo extends Thread { | |
public void run(){ | |
try { | |
System.out.println("Thread"+ Thread.currentThread().getId()+" is running"); | |
} | |
catch(Exception e){ | |
System.out.println("Exception is caught"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Welcome!</title> | |
</head> | |
<body> | |
<h1>Showing Data for ${empName}!</h1> | |
<h4>Email: ${email}</h4> | |
<h4>Address: ${address}</h4> | |
<h4>Date of Birth: ${dob}</h4> |
NewerOlder