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
public class ContiniousPrintDemo { | |
public static void main(String[] args) { | |
Counter count = new Counter(); | |
Thread t = new Thread(new Runnable(){ | |
@Override | |
public void run() { | |
synchronized (count) { |
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
/** | |
* Volatile Keyword, the volatile modifier guarantees that any thread that | |
* reads a field will see the most recently written value.” | |
* @author | |
*/ | |
import java.util.Scanner; | |
class ProcessorNew extends Thread { |
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
public class ThreadDemoWithRunnable { | |
public static void main(String[] args) { | |
myStart(); | |
} | |
public static void myStart(){ | |
Thread t = new Thread(new MyThread1()); | |
Thread t1 = new Thread(new MyThread1()); |
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
public class ThreadDemo { | |
public static void main(String[] args) { | |
MyThread t = new MyThread(); // creating thread 1 | |
MyThread t1 = new MyThread(); // creating thread 1 | |
t.start(); // starting the thread | |
t1.start(); // starting the thread | |
// t.run(); | |
// t1.run(); |
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
import java.io.*; | |
import java.net.URL; | |
import java.util.ArrayList; | |
import java.util.List; | |
import static java.lang.System.out; | |
class Journal | |
{ | |
private final List<String> entries = new ArrayList<>(); |
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
/** | |
* The Class BuilderDesignOfInterheritanceDemo. | |
*/ | |
public class BuilderDesignOfInterheritanceDemo { | |
public static void main(String[] args) { | |
PersonA p = new EmployementBuilder() | |
.withName("Noeik") |
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
/** | |
* The Class BuilderDesignPatternDemo. | |
*/ | |
public class BuilderDesignPatternDemo { | |
public static void main(String[] args) { | |
Person p = new PersonBuilder() | |
.name("Noeik") |
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 javatest; | |
/** | |
* Interface containing the important methods | |
* @author Rajendra | |
* | |
* @param <T> | |
*/ | |
interface List<T>{ | |
boolean add(T data); |
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
public class Subtract { | |
public int minus(int a, int b) | |
{ | |
return a - b; | |
} | |
} |
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.vp.springmvc.config; | |
import javax.servlet.ServletContext; | |
import javax.servlet.ServletException; | |
import javax.servlet.ServletRegistration; | |
import org.springframework.web.WebApplicationInitializer; | |
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; | |
import org.springframework.web.servlet.DispatcherServlet; |