diff --git a/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java b/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java index 063c835481..78b54713b5 100644 --- a/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java +++ b/core-java-modules/core-java-concurrency-advanced/src/main/java/com/baeldung/concurrent/volatilekeyword/SharedObject.java @@ -4,7 +4,7 @@ package com.baeldung.concurrent.volatilekeyword; public class SharedObject { private volatile int count=0; - void increamentCount(){ + void incrementCount(){ count++; } public int getCount(){ diff --git a/core-java-modules/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java b/core-java-modules/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java index 731ae887e1..45517cefd7 100644 --- a/core-java-modules/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java +++ b/core-java-modules/core-java-concurrency-advanced/src/test/java/com/baeldung/concurrent/volatilekeyword/SharedObjectManualTest.java @@ -10,7 +10,7 @@ public class SharedObjectManualTest { public void whenOneThreadWrites_thenVolatileReadsFromMainMemory() throws InterruptedException { SharedObject sharedObject = new SharedObject(); - Thread writer = new Thread(() -> sharedObject.increamentCount()); + Thread writer = new Thread(() -> sharedObject.incrementCount()); writer.start(); Thread.sleep(100); @@ -31,11 +31,11 @@ public class SharedObjectManualTest { @Test public void whenTwoThreadWrites_thenVolatileReadsFromMainMemory() throws InterruptedException { SharedObject sharedObject = new SharedObject(); - Thread writerOne = new Thread(() -> sharedObject.increamentCount()); + Thread writerOne = new Thread(() -> sharedObject.incrementCount()); writerOne.start(); Thread.sleep(100); - Thread writerTwo = new Thread(() -> sharedObject.increamentCount()); + Thread writerTwo = new Thread(() -> sharedObject.incrementCount()); writerTwo.start(); Thread.sleep(100);