chiwormjava 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/java.json +72 -1
- package/package.json +2 -1
- package/readme.md +154 -1
package/index.js
CHANGED
package/java.json
CHANGED
|
@@ -2,5 +2,76 @@
|
|
|
2
2
|
"linkedlist": {
|
|
3
3
|
"title": "Linked List",
|
|
4
4
|
"code": "class Outer{\\n\\tclass LinkedList{\\n\\t\\tclass Node{\\n\\t\\t\\tint data;\\n\\t\\t\\tNode next;\\n\\n\\t\\t\\tNode(int data){\\n\\t\\t\\t\\tthis.data = data;\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\tNode head = null;\\n\\n\\t\\tvoid add(int data){\\n\\t\\t\\tNode n = new Node(data);\\n\\n\\t\\t\\tif(head == null){\\n\\t\\t\\t\\thead = n;\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\n\\t\\t\\tNode temp = head;\\n\\t\\t\\twhile(temp.next != null){\\n\\t\\t\\t\\ttemp = temp.next;\\n\\t\\t\\t}\\n\\n\\t\\t\\ttemp.next = n;\\n\\t\\t}\\n\\n\\t\\tvoid remove(int data){\\n\\t\\t\\tif(head == null) return;\\n\\n\\t\\t\\tif(head.data == data){\\n\\t\\t\\t\\thead = head.next;\\n\\t\\t\\t\\treturn;\\n\\t\\t\\t}\\n\\n\\t\\t\\tNode temp = head;\\n\\t\\t\\twhile (temp.next != null){\\n\\t\\t\\t\\tif(temp.next.data == data){\\n\\t\\t\\t\\t\\ttemp.next = temp.next.next;\\n\\t\\t\\t\\t\\treturn;\\n\\t\\t\\t\\t}\\n\\t\\t\\t\\ttemp = temp.next;\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\tvoid display(){\\n\\t\\t\\tNode temp = head;\\n\\t\\t\\twhile(temp != null){\\n\\t\\t\\t\\tSystem.out.println(temp.data + \\\" \\\" );\\n\\t\\t\\t\\ttemp = temp.next;\\n\\t\\t\\t}\\n\\t\\t\\tSystem.out.println();\\n\\t\\t}\\n\\t}\\n\\n\\tpublic static void main(String []args){\\n\\t\\tOuter o = new Outer();\\n\\t\\tLinkedList list = o.new LinkedList();\\n\\n\\t\\tlist.add(1);\\n\\t\\tlist.add(2);\\n\\t\\tlist.add(3);\\n\\n\\t\\tlist.display();\\n\\n\\t\\tlist.remove(2);\\n\\n\\t\\tlist.display();\\n\\t}\\n}"
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
"springboot_hello": {
|
|
8
|
+
"title": "Spring Boot Hello API",
|
|
9
|
+
"code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.GetMapping;\\nimport org.springframework.web.bind.annotation.RestController;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@RestController\\nclass HelloController {\\n\\n\\t@GetMapping(\\\"/hello\\\")\\n\\tpublic String sayHello() {\\n\\t\\treturn \\\"Hello From Developer...!!!\\\";\\n\\t}\\n}"
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
"springboot_calculator": {
|
|
13
|
+
"title": "Spring Boot Calculator API",
|
|
14
|
+
"code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.GetMapping;\\nimport org.springframework.web.bind.annotation.RequestParam;\\nimport org.springframework.web.bind.annotation.RestController;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@RestController\\nclass CalculatorController {\\n\\n\\t@GetMapping(\\\"/add\\\")\\n\\tpublic int add(@RequestParam int a, @RequestParam int b) {\\n\\t\\treturn a + b;\\n\\t}\\n\\n\\t@GetMapping(\\\"/sub\\\")\\n\\tpublic int subtract(@RequestParam int a, @RequestParam int b) {\\n\\t\\treturn a - b;\\n\\t}\\n\\n\\t@GetMapping(\\\"/mul\\\")\\n\\tpublic int multiply(@RequestParam int a, @RequestParam int b) {\\n\\t\\treturn a * b;\\n\\t}\\n\\n\\t@GetMapping(\\\"/div\\\")\\n\\tpublic String divide(@RequestParam int a, @RequestParam int b) {\\n\\t\\tif(b == 0) {\\n\\t\\t\\treturn \\\"Cannot divide by zero\\\";\\n\\t\\t}\\n\\t\\treturn String.valueOf(a / b);\\n\\t}\\n}"
|
|
15
|
+
},
|
|
16
|
+
"springboot_even_odd": {
|
|
17
|
+
"title": "Spring Boot Even Odd API",
|
|
18
|
+
"code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.*;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@RestController\\nclass EvenOddController {\\n\\n\\t@GetMapping(\\\"/check\\\")\\n\\tpublic String checkEvenOdd(@RequestParam int number) {\\n\\t\\tif (number % 2 == 0) {\\n\\t\\t\\treturn number + \\\" is Even\\\";\\n\\t\\t} else {\\n\\t\\t\\treturn number + \\\" is Odd\\\";\\n\\t\\t}\\n\\t}\\n}"
|
|
19
|
+
},
|
|
20
|
+
"springboot_factorial": {
|
|
21
|
+
"title": "Spring Boot Factorial API (Service + Controller)",
|
|
22
|
+
"code": "package com.example.demo;\\n\\nimport org.springframework.boot.SpringApplication;\\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\\nimport org.springframework.web.bind.annotation.*;\\nimport org.springframework.beans.factory.annotation.Autowired;\\nimport org.springframework.stereotype.Service;\\n\\n@SpringBootApplication\\npublic class DemoApplication {\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tSpringApplication.run(DemoApplication.class, args);\\n\\t}\\n}\\n\\n@Service\\nclass FactorialService {\\n\\n\\tpublic long calculateFactorial(int n) {\\n\\t\\tif (n < 0) {\\n\\t\\t\\treturn -1;\\n\\t\\t}\\n\\n\\t\\tlong result = 1;\\n\\t\\tfor (int i = 1; i <= n; i++) {\\n\\t\\t\\tresult *= i;\\n\\t\\t}\\n\\n\\t\\treturn result;\\n\\t}\\n}\\n\\n@RestController\\nclass FactorialController {\\n\\n\\t@Autowired\\n\\tprivate FactorialService factorialService;\\n\\n\\t@GetMapping(\\\"/factorial\\\")\\n\\tpublic String getFactorial(@RequestParam int number) {\\n\\n\\t\\tlong result = factorialService.calculateFactorial(number);\\n\\n\\t\\tif (result == -1) {\\n\\t\\t\\treturn \\\"Invalid number\\\";\\n\\t\\t}\\n\\n\\t\\treturn \\\"Factorial of \\\" + number + \\\" is \\\" + result;\\n\\t}\\n}"
|
|
23
|
+
},
|
|
24
|
+
"custom_exception_java": {
|
|
25
|
+
"title": "Java Custom Exception Example",
|
|
26
|
+
"code": "class MyException extends Exception {\\n\\n\\tMyException(String message) {\\n\\t\\tsuper(message);\\n\\t}\\n}\\n\\npublic class CustomExceptionDemo {\\n\\n\\tstatic void checkAge(int age) throws MyException {\\n\\t\\tif (age < 18) {\\n\\t\\t\\tthrow new MyException(\\\"Age must be 18 or above\\\");\\n\\t\\t} else {\\n\\t\\t\\tSystem.out.println(\\\"You are eligible\\\");\\n\\t\\t}\\n\\t}\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\ttry {\\n\\t\\t\\tcheckAge(16);\\n\\t\\t} catch (MyException e) {\\n\\t\\t\\tSystem.out.println(\\\"Exception: \\\" + e.getMessage());\\n\\t\\t}\\n\\t}\\n}"
|
|
27
|
+
},
|
|
28
|
+
"thread_lifecycle_java": {
|
|
29
|
+
"title": "Java Thread Life Cycle Example",
|
|
30
|
+
"code": "class MyThread extends Thread {\\n\\n\\tpublic void run() {\\n\\t\\tSystem.out.println(\\\"Thread is in RUNNING state\\\");\\n\\n\\t\\ttry {\\n\\t\\t\\tThread.sleep(1000);\\n\\t\\t\\tSystem.out.println(\\\"Thread is in TIMED WAITING state\\\");\\n\\t\\t} catch (InterruptedException e) {\\n\\t\\t\\tSystem.out.println(e);\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"Thread execution finished (TERMINATED)\\\");\\n\\t}\\n}\\n\\npublic class ThreadLifeCycleDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tMyThread t1 = new MyThread();\\n\\n\\t\\tSystem.out.println(\\\"State after creation: \\\" + t1.getState());\\n\\n\\t\\tt1.start();\\n\\t\\tSystem.out.println(\\\"State after start(): \\\" + t1.getState());\\n\\n\\t\\ttry {\\n\\t\\t\\tThread.sleep(500);\\n\\t\\t\\tSystem.out.println(\\\"State during execution: \\\" + t1.getState());\\n\\t\\t\\tt1.join();\\n\\t\\t} catch (InterruptedException e) {\\n\\t\\t\\tSystem.out.println(e);\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"State after completion: \\\" + t1.getState());\\n\\t}\\n}"
|
|
31
|
+
},
|
|
32
|
+
"inner_class_java": {
|
|
33
|
+
"title": "Java Outer and Inner Class Example",
|
|
34
|
+
"code": "class Outer {\\n\\n\\tclass Inner {\\n\\t\\tint value = 10;\\n\\n\\t\\tvoid display() {\\n\\t\\t\\tSystem.out.println(\\\"Inner class method called\\\");\\n\\t\\t}\\n\\t}\\n\\n\\tvoid accessInner() {\\n\\t\\tInner obj = new Inner();\\n\\n\\t\\tSystem.out.println(\\\"Value from Inner class: \\\" + obj.value);\\n\\t\\tobj.display();\\n\\t}\\n\\n\\tpublic static void main(String[] args) {\\n\\t\\tOuter o = new Outer();\\n\\t\\to.accessInner();\\n\\t}\\n}"
|
|
35
|
+
},
|
|
36
|
+
"interface_drawable_java": {
|
|
37
|
+
"title": "Java Interface Drawable Example",
|
|
38
|
+
"code": "interface Drawable {\\n\\tvoid draw();\\n}\\n\\nclass Circle implements Drawable {\\n\\n\\tpublic void draw() {\\n\\t\\tSystem.out.println(\\\"Drawing Circle\\\");\\n\\t}\\n}\\n\\nclass Rectangle implements Drawable {\\n\\n\\tpublic void draw() {\\n\\t\\tSystem.out.println(\\\"Drawing Rectangle\\\");\\n\\t}\\n}\\n\\npublic class InterfaceDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tDrawable d1 = new Circle();\\n\\t\\tDrawable d2 = new Rectangle();\\n\\n\\t\\td1.draw();\\n\\t\\td2.draw();\\n\\t}\\n}"
|
|
39
|
+
},
|
|
40
|
+
"java_package_example": {
|
|
41
|
+
"title": "Java Package Creation and Import Example",
|
|
42
|
+
"code": "package com.example.geometry;\\n\\npublic class Shape {\\n\\n\\tpublic void draw() {\\n\\t\\tSystem.out.println(\\\"Drawing Shape\\\");\\n\\t}\\n}\\n\\n// In another file\\n\\nimport com.example.geometry.Shape;\\n\\npublic class PackageDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tShape s = new Shape();\\n\\t\\ts.draw();\\n\\t}\\n}"
|
|
43
|
+
},
|
|
44
|
+
"inheritance_shape_java": {
|
|
45
|
+
"title": "Java Inheritance and Method Overriding Example",
|
|
46
|
+
"code": "class Shape {\\n\\n\\tvoid calculateArea() {\\n\\t\\tSystem.out.println(\\\"Calculating area of shape\\\");\\n\\t}\\n}\\n\\nclass Circle extends Shape {\\n\\tdouble radius = 5;\\n\\n\\tvoid calculateArea() {\\n\\t\\tdouble area = Math.PI * radius * radius;\\n\\t\\tSystem.out.println(\\\"Area of Circle: \\\" + area);\\n\\t}\\n}\\n\\nclass Rectangle extends Shape {\\n\\tint length = 4;\\n\\tint width = 6;\\n\\n\\tvoid calculateArea() {\\n\\t\\tint area = length * width;\\n\\t\\tSystem.out.println(\\\"Area of Rectangle: \\\" + area);\\n\\t}\\n}\\n\\npublic class InheritanceDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tShape s1 = new Circle();\\n\\t\\tShape s2 = new Rectangle();\\n\\n\\t\\ts1.calculateArea();\\n\\t\\ts2.calculateArea();\\n\\t}\\n}"
|
|
47
|
+
},
|
|
48
|
+
"method_overloading_java": {
|
|
49
|
+
"title": "Java Method Overloading Calculator Example",
|
|
50
|
+
"code": "class Calculator {\\n\\n\\tint add(int a, int b) {\\n\\t\\treturn a + b;\\n\\t}\\n\\n\\tdouble add(double a, double b) {\\n\\t\\treturn a + b;\\n\\t}\\n}\\n\\npublic class MethodOverloadingDemo {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tCalculator calc = new Calculator();\\n\\n\\t\\tint intResult = calc.add(10, 20);\\n\\t\\tSystem.out.println(\\\"Integer Addition: \\\" + intResult);\\n\\n\\t\\tdouble doubleResult = calc.add(5.5, 2.3);\\n\\t\\tSystem.out.println(\\\"Double Addition: \\\" + doubleResult);\\n\\t}\\n}"
|
|
51
|
+
},
|
|
52
|
+
"palindrome_user_input_java": {
|
|
53
|
+
"title": "Java Palindrome Number with User Input",
|
|
54
|
+
"code": "import java.util.Scanner;\\n\\npublic class Palindrome {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tint original = num;\\n\\t\\tint reverse = 0;\\n\\n\\t\\twhile (num > 0) {\\n\\t\\t\\tint digit = num % 10;\\n\\t\\t\\treverse = reverse * 10 + digit;\\n\\t\\t\\tnum = num / 10;\\n\\t\\t}\\n\\n\\t\\tif (original == reverse) {\\n\\t\\t\\tSystem.out.println(\\\"Palindrome Number\\\");\\n\\t\\t} else {\\n\\t\\t\\tSystem.out.println(\\\"Not a Palindrome\\\");\\n\\t\\t}\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
|
|
55
|
+
},
|
|
56
|
+
"fibonacci_user_input_java": {
|
|
57
|
+
"title": "Java Fibonacci Series with User Input",
|
|
58
|
+
"code": "import java.util.Scanner;\\n\\npublic class Fibonacci {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter number of terms: \\\" );\\n\\t\\tint n = sc.nextInt();\\n\\n\\t\\tint a = 0, b = 1;\\n\\n\\t\\tSystem.out.println(\\\"Fibonacci Series:\\\");\\n\\n\\t\\tfor (int i = 1; i <= n; i++) {\\n\\t\\t\\tSystem.out.print(a + \\\" \\\" );\\n\\n\\t\\t\\tint next = a + b;\\n\\t\\t\\ta = b;\\n\\t\\t\\tb = next;\\n\\t\\t}\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
|
|
59
|
+
},
|
|
60
|
+
"armstrong_user_input_java": {
|
|
61
|
+
"title": "Java Armstrong Number with User Input",
|
|
62
|
+
"code": "import java.util.Scanner;\\n\\npublic class Armstrong {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tint original = num;\\n\\t\\tint sum = 0;\\n\\t\\tint digits = 0;\\n\\n\\t\\tint temp = num;\\n\\t\\twhile (temp > 0) {\\n\\t\\t\\tdigits++;\\n\\t\\t\\ttemp = temp / 10;\\n\\t\\t}\\n\\n\\t\\ttemp = num;\\n\\t\\twhile (temp > 0) {\\n\\t\\t\\tint digit = temp % 10;\\n\\t\\t\\tsum += Math.pow(digit, digits);\\n\\t\\t\\ttemp = temp / 10;\\n\\t\\t}\\n\\n\\t\\tif (sum == original) {\\n\\t\\t\\tSystem.out.println(\\\"Armstrong Number\\\");\\n\\t\\t} else {\\n\\t\\t\\tSystem.out.println(\\\"Not an Armstrong Number\\\");\\n\\t\\t}\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
|
|
63
|
+
},
|
|
64
|
+
"prime_user_input_java": {
|
|
65
|
+
"title": "Java Prime Number with User Input",
|
|
66
|
+
"code": "import java.util.Scanner;\\n\\npublic class Prime {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tboolean isPrime = true;\\n\\n\\t\\tif (num <= 1) {\\n\\t\\t\\tisPrime = false;\\n\\t\\t} else {\\n\\t\\t\\tfor (int i = 2; i <= num / 2; i++) {\\n\\t\\t\\t\\tif (num % i == 0) {\\n\\t\\t\\t\\t\\tisPrime = false;\\n\\t\\t\\t\\t\\tbreak;\\n\\t\\t\\t\\t}\\n\\t\\t\\t}\\n\\t\\t}\\n\\n\\t\\tif (isPrime) {\\n\\t\\t\\tSystem.out.println(\\\"Prime Number\\\");\\n\\t\\t} else {\\n\\t\\t\\tSystem.out.println(\\\"Not a Prime Number\\\");\\n\\t\\t}\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
|
|
67
|
+
},
|
|
68
|
+
"factorial_user_input_java": {
|
|
69
|
+
"title": "Java Factorial with User Input",
|
|
70
|
+
"code": "import java.util.Scanner;\\n\\npublic class Factorial {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tlong fact = 1;\\n\\n\\t\\tfor (int i = 1; i <= num; i++) {\\n\\t\\t\\tfact *= i;\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"Factorial: \\\" + fact);\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
|
|
71
|
+
},
|
|
72
|
+
"reverse_number_java": {
|
|
73
|
+
"title": "Java Reverse Number with User Input",
|
|
74
|
+
"code": "import java.util.Scanner;\\n\\npublic class ReverseNumber {\\n\\n\\tpublic static void main(String[] args) {\\n\\n\\t\\tScanner sc = new Scanner(System.in);\\n\\n\\t\\tSystem.out.print(\\\"Enter a number: \\\" );\\n\\t\\tint num = sc.nextInt();\\n\\n\\t\\tint reverse = 0;\\n\\n\\t\\twhile (num > 0) {\\n\\t\\t\\tint digit = num % 10;\\n\\t\\t\\treverse = reverse * 10 + digit;\\n\\t\\t\\tnum = num / 10;\\n\\t\\t}\\n\\n\\t\\tSystem.out.println(\\\"Reversed Number: \\\" + reverse);\\n\\n\\t\\tsc.close();\\n\\t}\\n}"
|
|
5
75
|
}
|
|
6
|
-
}
|
|
76
|
+
}
|
|
77
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chiwormjava",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"description": "",
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"chiwormjava": "^1.0.0",
|
|
16
17
|
"express": "^5.2.1",
|
|
17
18
|
"open": "^11.0.0"
|
|
18
19
|
}
|
package/readme.md
CHANGED
|
@@ -69,4 +69,157 @@ class Outer{
|
|
|
69
69
|
|
|
70
70
|
list.display();
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
http://localhost:8080/check?number=5
|
|
75
|
+
|
|
76
|
+
▶️ How to Use
|
|
77
|
+
|
|
78
|
+
Run the application and open these URLs in browser:
|
|
79
|
+
|
|
80
|
+
Addition → http://localhost:8080/add?a=10&b=5 → 15
|
|
81
|
+
Subtraction → http://localhost:8080/sub?a=10&b=5 → 5
|
|
82
|
+
Multiplication → http://localhost:8080/mul?a=10&b=5 → 50
|
|
83
|
+
Division → http://localhost:8080/div?a=10&b=5 → 2
|
|
84
|
+
|
|
85
|
+
# 🚀 Java Code Watch
|
|
86
|
+
|
|
87
|
+
A simple CLI tool to **view and copy Java data structure code** (like LinkedList, Stack, etc.) directly in your browser.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 📦 Installation
|
|
92
|
+
|
|
93
|
+
### Option 1: Use without installing (recommended)
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npx javacodewatch
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### Option 2: Install locally
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm install chiwormjava
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Run:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx javacodewatch
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### Option 3: Install globally (optional)
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npm install -g chiwormjava
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Run:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
javacodewatch
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 🧠 What it does
|
|
130
|
+
|
|
131
|
+
* Opens a local server
|
|
132
|
+
* Launches your browser
|
|
133
|
+
* Shows Java code snippets
|
|
134
|
+
* Click → View code
|
|
135
|
+
* Click → Copy code
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 📸 Features
|
|
140
|
+
|
|
141
|
+
* 📚 Java DSA snippets (LinkedList, etc.)
|
|
142
|
+
* 🖱️ One-click code view
|
|
143
|
+
* 📋 Copy to clipboard
|
|
144
|
+
* 🌙 Clean dark UI
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ▶️ Usage
|
|
149
|
+
|
|
150
|
+
After running the command:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
javacodewatch
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
👉 Your browser will open automatically:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
http://localhost:3000
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 📁 Project Structure
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
chiwormjava/
|
|
168
|
+
├── index.js # CLI entry point
|
|
169
|
+
├── java.json # Code snippets
|
|
170
|
+
├── package.json
|
|
171
|
+
└── README.md
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## ⚙️ Development
|
|
177
|
+
|
|
178
|
+
Clone the repo:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
git clone <your-repo-link>
|
|
182
|
+
cd chiwormjava
|
|
183
|
+
npm install
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Run locally:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
node index.js
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 🧪 Example
|
|
195
|
+
|
|
196
|
+
Click on **LinkedList** → See full Java implementation → Click **Copy**
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 🛠️ Tech Stack
|
|
201
|
+
|
|
202
|
+
* Node.js
|
|
203
|
+
* Express
|
|
204
|
+
* Vanilla JS (Frontend)
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 📌 Future Improvements
|
|
209
|
+
|
|
210
|
+
* 🔍 Search functionality
|
|
211
|
+
* 📂 Categories (Stack, Queue, Tree)
|
|
212
|
+
* 🎨 Syntax highlighting
|
|
213
|
+
* 🌐 Online hosted version
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 👨💻 Author
|
|
218
|
+
|
|
219
|
+
Your Name
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## ⭐ Support
|
|
224
|
+
|
|
225
|
+
If you like this project, give it a ⭐ on GitHub!
|