A collection of Java tutorials, examples, and exercises covering core Java concepts and blockchain implementation.
Learn about type safety and unchecked casting in Java:
Explore collections with the HashTable class implementation:
import java.util.Hashtable;
class HashTable {
public static void main(String[] arg) {
// Creating a hash table
Hashtable<Integer, String> h = new Hashtable<Integer, String>();
h.put(3, "Geeks");
h.put(2, "forGeeks");
h.put(1, "isBest");
h.put(4, "Quamm");
h.put(5, "Qq");
h.put(6, "Qq");
// Create a clone or shallow copy of hash table h
Hashtable<Integer, String> h1 = (Hashtable<Integer, String>) h.clone();
Hashtable<Integer, String> h2 = (Hashtable<Integer, String>) h1.clone();
System.out.println("-- start --");
System.out.println(">h: " + h);
System.out.println("clone h->h1: " + h1);
// Clear hash table h
h.clear();
// Checking hash table h
System.out.println("after clearing h: " + h);
System.out.println(">h1: " + h1);
System.out.println(">h2: " + h2);
// Proper way to create a clone of hash table
Hashtable<?, ?> h3 = (Hashtable<?, ?>) h.clone();
System.out.println(">(String) h3: " + h3);
}
}Key Classes:
- 📁
HashTable.java- Hashtable implementation examples - 📁
Vehicle.java- Vehicle class hierarchy examples - 📁
CollectionsEx1.java- Nested collections examples - 📁
OptionalBasicExample.java- Optional API examples
A simple blockchain implementation built with Java, based on industry best practices and detailed articles.
- Block.java 🧱 - Represents individual blocks in the blockchain chain
- NoobChain.java ⛓️ - Basic blockchain implementation
- NoobChainV2.java ⛓️ - Enhanced blockchain with transactions
- StringUtil.java 🔧 - Utility functions for blockchain operations
- Transaction.java 💰 - Transaction handling
- TransactionInput.java 📥 - Transaction input management
- TransactionOutput.java 📤 - Transaction output management
- Wallet.java 💳 - Wallet functionality for blockchain
| Date | Event |
|---|---|
| 2019-11-03 | Added Gradle configuration for log4j2 JAR generation |
| 2019-11-06 | Added blockchain package |
| 2020-02-14 | Updated README.md documentation |
# Build the project
./gradlew build
# Run tests
./gradlew testThis project contains examples and tutorials referenced from various sources including Medium and UltimaSolution blog posts.