Command Line Arguments

🧾 Command Line Arguments in Java Command Line Arguments allow users to pass input parameters to the program when it is executed, enabling dynamic behavior without changing code. 🧠 Concept Java’s main() method accepts an array of String arguments: public static void main(String[] args) args holds the command line values as strings. args[0], args[1], etc. refer to individual arguments. 🧪 Example public class CmdArgs { public static void main(String[] args) { System.out.println("Number of arguments: " + args.length); for (int i = 0; i < args.length; i++) { System.out.println("Arg " + i + ": " + args[i]); } } } 🔹 Running the program: java CmdArgs Alice Bob 🔹 Output: Number of arguments: 2 Arg 0: Alice Arg 1: Bob ⚠️ Notes All inputs are read as String. You must parse them (e.g., Integer.parseInt()) if needed. Handle cases when arguments are missing to avoid ArrayIndexOutOfBoundsException. 🔗 Related Notes Input Output Statements Features of Java

May 8, 2025 · 1 min · Rohan

Input Output Statements

🖨️ Input/Output Statements in Java Java provides various mechanisms to accept input from the user and display output to the screen, typically using classes from the java.io and java.util packages. 📥 Input in Java The most common way to accept user input is through the Scanner class. 🔹 Example Using Scanner import java.util.Scanner; public class InputExample { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter your name: "); String name = sc.nextLine(); System.out.println("Hello, " + name); } } 📤 Output in Java Java uses System.out.println() and System.out.print() for output. ...

May 8, 2025 · 1 min · Rohan

Introduction to Computer Networking Concepts

Introduction to Computer Networking Concepts Computer networking connects computing devices to enable data sharing and communication. This foundation supports services like the internet, file sharing, and cloud computing. 🔹 Purposes of Digital Communication and Computer Networks Resource Sharing: Access shared printers, files, storage. Communication: Email, chat, video conferencing. Remote Access: Control systems across locations. Centralized Data: Easier management and backups. Efficiency: Distributed workloads and services. 🔹 Types of Digital Communication and Computer Networks Network Coverage Area Example PAN Personal range (~10 meters) Bluetooth headset LAN Building or campus Home/office Wi-Fi MAN Citywide University networks WAN Country or global Internet 🖼️ Textual Diagram - Network Scale PAN < LAN < MAN < WAN 🔹 Network Components End Devices: Users’ computers, phones. Network Devices: Switch: Connects devices in a LAN (uses MAC address). Router: Connects different networks (uses IP). Modem: Converts digital ↔ analog for ISP. Hub: Broadcasts data to all ports (no intelligence). Bridge: Connects LAN segments, filters by MAC. Repeater: Regenerates weak signals. Access Point: Provides Wi-Fi access. Network Interface Card (NIC): Hardware to connect devices to a network. Transceivers: Send and receive signals over media. Transmission Media: Wired: Ethernet (Cat6), Fiber. Wireless: Wi-Fi, 4G/5G, Bluetooth. 🖼️ Textual Diagram - Basic LAN Setup [PC]---+ | [PC]---+--[SWITCH]---[ROUTER]---[INTERNET] | [Printer] 🔹 Communication Modes Mode Description Example Simplex One-way only Keyboard to PC Half Duplex Two-way, one at a time Walkie-talkies Full Duplex Two-way, simultaneous Phone calls 🖼️ Textual Diagram - Duplex Modes Simplex: A ---> B Half-Duplex: A <--> B (one at a time) Full-Duplex: A <===> B (simultaneous) 🔹 Transmission Types Unicast: One-to-one Broadcast: One-to-all Multicast: One-to-selected Anycast: One-to-nearest 🖼️ Textual Diagram - Broadcast vs Unicast Unicast: [Sender] ---> [Receiver] Broadcast: [Sender] ---> [All Devices on Network] Multicast: [Sender] ---> [Group of Devices] Anycast: [Sender] ---> [Nearest Suitable Receiver] 🔹 Communication Models Peer-to-Peer (P2P): ...

May 3, 2025 · 3 min · Rohan