Compare and Swap in Java

Jakob Jenkov November 25, 2021
Video Thumbnail
Jakob Jenkov Logo

Jakob Jenkov

View Channel

About

Hi, I make videos about software development related topics like Java, web development etc. Occassionally I'll drop a video or two about career related issues too. Oh, I also run the tutorial website http://jenkov.com . I try to cover each topic in reasonable depth. My own experience has been, that the deeper my understanding of topics within software development is - the better and faster a developer I become. I started programming around 1987 (around age 12) on the C128 - in C128 Basic - then on the Amiga 500 in AMOS and Assembler, then later PC and C. I started working with software as job from 1998 as web dev, and from 1999 as Java + web dev, so I've been in the game a long time :-) From around 2000 and forward I have mostly been working as a freelance, onsite consultant with Java, web and distributed systems deelopment. I love being self employed - but it's a lot of work.

You May Also Like

Protect Your New iPhone

AI-recommended products based on this video

Loading...
for Magsafe Car Mount【20 Strong Magnets 】Magnetic Phone Holder for Car Phone Holder Mount Dash【360°】Cell Phone Mount for Car Accessories,Car Mount for iPhone 16 Pro Max 15 14 13 12 Plus MagSafe Cases

for Magsafe Car Mount【20 Strong Magnets 】Magnetic Phone Holder for Car Phone Holder Mount Dash【360°】Cell Phone Mount for Car Accessories,Car Mount for iPhone 16 Pro Max 15 14 13 12 Plus MagSafe Cases

(11,563)
$16.98
FREE delivery Tue, Jun 17 on your first order
3K+ bought in past month
Loading...
Otterbox Commuter Series case for iPhone XR - Frustration Free Packaging - Black

Otterbox Commuter Series case for iPhone XR - Frustration Free Packaging - Black

(5,871)
$29.95
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
Otterbox Commuter Series Case for iPhone 11 - Bespoke Way (blazer Blue/Stormy Seas Blue)

Otterbox Commuter Series Case for iPhone 11 - Bespoke Way (blazer Blue/Stormy Seas Blue)

(9,305)
$29.47
FREE delivery Sat, Jun 14 on your first order
200+ bought in past month
Loading...
Spigen Case for Galaxy S25 Case, Tough Armor (Ai) MagFit [Wireless Charging] Compatible with MagSafe - Black

Spigen Case for Galaxy S25 Case, Tough Armor (Ai) MagFit [Wireless Charging] Compatible with MagSafe - Black

(2,126)
$28.99
FREE delivery Sat, Jun 14 on your first order
500+ bought in past month
Loading...
Spigen Case for iPhone 16 Case, Tough Armor Designed for Apple iPhone 16 - Black

Spigen Case for iPhone 16 Case, Tough Armor Designed for Apple iPhone 16 - Black

(126)
$22.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
Spigen Case for iPhone 16 Pro Case, Tough Armor [MagFit] Compatible with MagSafe - Black

Spigen Case for iPhone 16 Pro Case, Tough Armor [MagFit] Compatible with MagSafe - Black

(341)
$32.99
FREE delivery Sat, Jun 14 on your first order
Loading...
Spigen Case for iPhone 16 Plus Case, Tough Armor (AI) [MagFit] Compatible with MagSafe - Black

Spigen Case for iPhone 16 Plus Case, Tough Armor (AI) [MagFit] Compatible with MagSafe - Black

(818)
$29.99
FREE delivery Sat, Jun 14 on your first order
Loading...
ivoler 3-in-1 Case Designed for iPhone 17 6.3'' 2025 with 2 Pack Tempered Glass Screen Protector, [Military Grade Drop Protection] Hard Back Slim Shockproof Phone Cover, Anti-Scratch, Clear

ivoler 3-in-1 Case Designed for iPhone 17 6.3'' 2025 with 2 Pack Tempered Glass Screen Protector, [Military Grade Drop Protection] Hard Back Slim Shockproof Phone Cover, Anti-Scratch, Clear

(1,463)
$13.99
FREE delivery Sat, Sep 20 on your first order
200+ bought in past month
Loading...
[3+3 Pack] for Samsung Galaxy S25 Screen Protector, 9H Tempered Glass, Ultrasonic Fingerprint Compatible, HD Clear Case Friendly for Samsung S25 Tempered Glass Screen Protector 5G

[3+3 Pack] for Samsung Galaxy S25 Screen Protector, 9H Tempered Glass, Ultrasonic Fingerprint Compatible, HD Clear Case Friendly for Samsung S25 Tempered Glass Screen Protector 5G

(746)
$12.99
FREE delivery Mon, Aug 25 on your first order
2K+ bought in past month
Loading...
ivoler 4-Pack Screen Protector Tempered Glass for Nintendo Switch 2 Model 2025 with [Alignment Frame] Accessories Transparent HD Clear Anti-Scratch Screen Protector for Nintendo Switch 2, 7.9-Inch ClimatePartner certified

ivoler 4-Pack Screen Protector Tempered Glass for Nintendo Switch 2 Model 2025 with [Alignment Frame] Accessories Transparent HD Clear Anti-Scratch Screen Protector for Nintendo Switch 2, 7.9-Inch ClimatePartner certified

(31,237)
$13.99
FREE delivery Mon, Nov 17 on your first order
1K+ bought in past month
Loading...
HEYSTOP Switch 2 Case for Nintendo Switch 2, Protective Case Compatible with Nintendo Switch 2, Switch 2 Accessories Kit with Grip Controller ,Tempered Glass Screen Protector, Thumb Stick Caps

HEYSTOP Switch 2 Case for Nintendo Switch 2, Protective Case Compatible with Nintendo Switch 2, Switch 2 Accessories Kit with Grip Controller ,Tempered Glass Screen Protector, Thumb Stick Caps

(60)
$23.99
FREE delivery Sun, Jun 15 on your first order
50+ bought in past month
Loading...
iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

(4,036)
$8.99
FREE delivery Sun, Jun 29 on your first order
2K+ bought in past month
Loading...
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

(5,626)
$17.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

(2,193)
$14.24
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
iPhone Charger Cord Lightning Cable (Apple MFi Certified) 6/6/10ft 3 Pack iPhone Cable Fast Charging Long Apple Charger Cable for iPhone 13 13 Pro 12 Pro 11 SE Max XS XR X, iPad Mini Air, iPod, AirPod

iPhone Charger Cord Lightning Cable (Apple MFi Certified) 6/6/10ft 3 Pack iPhone Cable Fast Charging Long Apple Charger Cable for iPhone 13 13 Pro 12 Pro 11 SE Max XS XR X, iPad Mini Air, iPod, AirPod

(4,371)
$9.99
FREE delivery Sat, Sep 20 on your first order
6K+ bought in past month
Loading...
Magnetic Wireless Charger for iPhone: Fodable 3 in 1 Charging Station for Multiple Apple Devices - Travel Charging Pad Dock for Apple Watch iPhone 16 15 14 13 12 Pro Max Plus & Airpod Global Recycled Standard

Magnetic Wireless Charger for iPhone: Fodable 3 in 1 Charging Station for Multiple Apple Devices - Travel Charging Pad Dock for Apple Watch iPhone 16 15 14 13 12 Pro Max Plus & Airpod Global Recycled Standard

(656)
$49.99
PrimeFREE delivery Sat, Jun 14
100+ bought in past month
Loading...
Galaxy S24 S25 USB C Charging Block 25W PD Super Fast Charger Type C Wall Plug Adapter Quick Charge for Samsung Galaxy S25/S24/S23/S22/S21/S20/Z Fold 3/4/5/Note20/iPhone 15/16/iPad/Tablet/Watch-1Pack

Galaxy S24 S25 USB C Charging Block 25W PD Super Fast Charger Type C Wall Plug Adapter Quick Charge for Samsung Galaxy S25/S24/S23/S22/S21/S20/Z Fold 3/4/5/Note20/iPhone 15/16/iPad/Tablet/Watch-1Pack

(7,777)
$12.99
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
Multi Charging Cable, Multi Charger Cable 3 in 1 Charger Fast Charge Multiple Ends 4FT Braided Universal Charging Cord with USB C Micro Lightning Cord for iPhone iPad Samsung Android Phone Tablet Global Recycled Standard

Multi Charging Cable, Multi Charger Cable 3 in 1 Charger Fast Charge Multiple Ends 4FT Braided Universal Charging Cord with USB C Micro Lightning Cord for iPhone iPad Samsung Android Phone Tablet Global Recycled Standard

(41)
$8.99
FREE delivery Sun, Oct 5 on your first order
600+ bought in past month
Loading...
Anker USB C Cable, [2-Pack, 6 ft] Type C Charger Premium Nylon USB Cable, USB A to Type C Charging Cable Fast Charge for Samsung Galaxy S10 S10+ / Note 8, LG V20 and Other USB C Charger (Black)

Anker USB C Cable, [2-Pack, 6 ft] Type C Charger Premium Nylon USB Cable, USB A to Type C Charging Cable Fast Charge for Samsung Galaxy S10 S10+ / Note 8, LG V20 and Other USB C Charger (Black)

(103,365)
$13.49
5K+ bought in past month
Loading...
USB C Cable 6ft Type C Charger Cable 3.1A Fast Charging Nylon Braided USB A to USB C Charge Cord for Samsung Galaxy S25 S24 S23 S22 S21 S20 A12 A13 A14 A15 A16 A32 A53 5G Android Phone Tablet PS5 LG

USB C Cable 6ft Type C Charger Cable 3.1A Fast Charging Nylon Braided USB A to USB C Charge Cord for Samsung Galaxy S25 S24 S23 S22 S21 S20 A12 A13 A14 A15 A16 A32 A53 5G Android Phone Tablet PS5 LG

(4,378)
$8.41
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

(54,882)
$32.25
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month
Loading...
iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

(4,036)
$8.99
FREE delivery Sun, Jun 29 on your first order
2K+ bought in past month
Loading...
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

(5,626)
$17.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

(2,193)
$14.24
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

(54,882)
$32.25
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month
Loading...
iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

(4,036)
$8.99
FREE delivery Sun, Jun 29 on your first order
2K+ bought in past month
Loading...
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

(5,626)
$17.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

(2,193)
$14.24
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

(54,882)
$32.25
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month
Loading...
iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

(4,036)
$8.99
FREE delivery Sun, Jun 29 on your first order
2K+ bought in past month
Loading...
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

(5,626)
$17.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

(2,193)
$14.24
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month
Loading...
VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

VANMASS [85+LBS Strongest Suction & Clip] 2025 Upgrade Car Phone Holder [Patent & Safety Certs] Cell Phone Mount Truck Stand for Dashboard Windshield Vent for iPhone 16 Pro Max 15 14 13 12 Samsung

(54,882)
$32.25
FREE delivery Mon, Aug 25 on your first order
1K+ bought in past month
Loading...
iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

iPhone Charger Fast Charging [Apple MFi Certified] USB C to Lightning Cable 6FT USBC to Lightning Cable Nylon Braided Type C Cord for iPhone 14 13 12 11 Pro Max XR XS X 8 7 6 Plus SE, iPad

(4,036)
$8.99
FREE delivery Sun, Jun 29 on your first order
2K+ bought in past month
Loading...
iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

iPhone Charger [Apple MFi Certified] 3FT, 3Pack USB A to Lightning Cable Braided Fast Charging Apple Cord Compatible with iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad/iPod/AirPods

(5,626)
$17.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

2Pack 10ft iPhone Charger 90 Degree Lightning Cable Right Angle Long USB Charging Cord Compatible with Apple iPhone 14 13 12 11 Pro Max XS XR X 8 7 6 5 Plus iPad iPod

(2,193)
$14.24
FREE delivery Sat, Jun 14 on your first order
400+ bought in past month