☕ Day 7 – Java 2025: Smart, Stable, and Still the Future 💡 🔹 Topic: ASCII Value in Java 🧩 What is ASCII Value? ASCII stands for American Standard Code for Information Interchange. It is a numerical representation of characters — where every letter, number, or symbol is assigned a specific numeric value between 0 and 127. For example, 'A' → 65, 'a' → 97, '0' → 48. --- ⚙️ How We Can Use ASCII Values in Java In Java, each character (char) has an internal ASCII code. You can easily get this value by type casting a character to an integer. This helps programmers perform character comparisons, sorting, encryption, and pattern logic. --- 🎯 Purpose of ASCII Values 1️⃣ Character Comparison: To check which character comes first or is greater based on ASCII order. Example: 'A' < 'a' because 65 < 97. 2️⃣ Encoding & Data Transmission: When sending text over systems or networks, ASCII ensures characters are universally understood. 3️⃣ Sorting and Logic Building: Used in string sorting algorithms or validation logic (e.g., checking if a character is uppercase, lowercase, or a number). 4️⃣ Mathematical Operations on Characters: You can perform arithmetic operations like converting uppercase to lowercase using ASCII difference. --- 💻 Simple Example char ch = 'A'; int ascii = (int) ch; // Type casting char to int System.out.println("ASCII value of " + ch + " is: " + ascii); Output: ASCII value of A is: 65 --- 🧠 Extra Insight 'A' to 'Z' → 65 to 90 'a' to 'z' → 97 to 122 '0' to '9' → 48 to 57 ASCII makes Java programs language-neutral and machine-readable for text processing tasks. --- ✨ #Day7OfJava #Java2025 #LearnJava #ASCIICode #JavaBasics #JavaCharacters #JavaForBeginners #CodeWithSneha #ProgrammingConcepts #100DaysOfJava #TechLearning #DeveloperJourney
Sneha Burhade’s Post
More Relevant Posts
-
⭐𝐄𝐱𝐩𝐥𝐨𝐫𝐢𝐧𝐠 𝐚𝐛𝐨𝐮𝐭 𝐭𝐡𝐞 𝐓𝐨𝐤𝐞𝐧𝐬 𝐢𝐧 𝐉𝐚𝐯𝐚: In Java, tokens are the smallest meaningful elements of a program that the compiler can understand. They act as the fundamental building blocks of a Java program. Here's a breakdown of the types of tokens in Java: ➜ 1. Keywords: Reserved words in Java with predefined meanings. Examples: class, public, static, if, else, while, return, etc. Cannot be used as identifiers (e.g., variable names). ➜ 2. Identifiers: Names used to identify variables, methods, classes, or objects. • 𝐑𝐮𝐥𝐞𝐬: Must begin with a letter, _, or $. Cannot be a keyword. Case-sensitive. • 𝙀𝙭𝙖𝙢𝙥𝙡𝙚𝙨: myVariable, calculateSum. ➜ 3. Literals: Constant values directly used in the program. • 𝐓𝐲𝐩𝐞𝐬: Integer literals: 10, -5 Floating-point literals: 3.14, -0.01 Character literals: 'A', '9' String literals: "Hello", "Java" Boolean literals: true, false ➜ 4. Operators: Symbols used to perform operations on variables and values. • 𝐓𝐲𝐩𝐞𝐬: Arithmetic operators: +, -, *, /, % Relational operators: ==, !=, <, >, <=, >= Logical operators: &&, ||, ! Assignment operators: =, +=, -=, etc. ➜ 5. Separators (Delimiters): Characters used to separate tokens in a program. • 𝙀𝙭𝙖𝙢𝙥𝙡𝙚𝙨: 𝐏𝐚𝐫𝐞𝐧𝐭𝐡𝐞𝐬𝐞𝐬: () 𝐂𝐮𝐫𝐥𝐲 𝐛𝐫𝐚𝐜𝐞𝐬: { } 𝐒𝐞𝐦𝐢𝐜𝐨𝐥𝐨𝐧: ; 𝐂𝐨𝐦𝐦𝐚: , #java #Day3 #Corejava #Codegnan Thanks to my mentor: Anand Kumar Buddarapu Saketh Kallepu Uppugundla Sairam
To view or add a comment, sign in
-
-
🚀 Java Learning – I once wondered: 👉 “Why can’t we modify a String like we do with a StringBuilder?” Here’s why Strings are immutable in Java 👇 1️⃣ Security – Strings store sensitive data like DB URLs, usernames, and passwords. If they were mutable, their values could be changed after creation. 2️⃣ String Pool Optimization – The JVM reuses immutable Strings to save memory and improve performance. 3️⃣ Thread Safety – Immutable Strings can be shared safely across multiple threads. 4️⃣ HashMap Reliability – The hashCode of a String stays constant, making it a reliable key in Maps. ✨ Takeaway: Immutability is one of the key reasons Java is secure, efficient, and consistent. #Java #JavaDeveloper #Coding #TechLearning #StringImmutability #SoftwareDevelopment #Programming #CleanCode #JavaTips
To view or add a comment, sign in
-
🔥 #100DaysOfDSA — Day 29/100 Topic: Binary Search in Java ⚡ 💡 What I Did Today: Today, I implemented one of the most powerful and efficient searching algorithms — Binary Search 🔍 Instead of checking every element one by one like Linear Search, Binary Search smartly divides the array in half each time — reducing the time complexity drastically! 🧠 Logic Used: Works only on sorted arrays ✅ Find the mid index: mid = (start + end) / 2 If key == numbers[mid] → found the element 🎯 If key > numbers[mid] → search in right half Else → search in left half Continue until the element is found or the range is empty 📊 Example: Input → {4, 5, 6, 10, 18, 61, 122} Key → 61 ✅ Output → index for key is: 5 ⚙️ Time Complexity: O(log n) — super fast compared to O(n) of Linear Search 💨 ✨ Takeaway: Binary Search is a fundamental algorithm that teaches the power of divide and conquer. Mastering this concept builds the foundation for more advanced topics like search trees, sorting, and algorithm optimization 🚀 #100DaysOfCode #Day29 #Java #DSA #BinarySearch #ProblemSolving #CodingJourney #LearnInPublic #DeveloperLife #CodeNewbie
To view or add a comment, sign in
-
-
Today I’m sharing one of the most important Java concepts — Deep Copy vs Shallow Copy. When we copy objects in Java, it’s not always about duplicating data — sometimes we only copy references. This can cause unexpected behavior when one object changes and the other gets affected too. That’s where Deep Copy comes in! 💡 It creates a completely new object with its own copy of the data — ensuring changes in one object don’t impact the other. Here’s a simple example using HealthStatus and Character classes to show how Deep Copy keeps objects independent 👇 ✅ Output: The original object remains unchanged even after modifying the copy — a true Deep Copy! 💭 Deep Copy ensures data independence and prevents accidental side effects when working with objects containing references. #Java #Programming #OOP #DeepCopy #ShallowCopy #LearningJourney #CodeWithPavan #SoftwareDevelopment
To view or add a comment, sign in
-
Day - 52 #120DaysOfLearning | Java Full Stack ☑️ 𝐓𝐨𝐩𝐢𝐜: 𝐉𝐚𝐯𝐚 𝟖 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬 — Functional Interface, Lambda Expression, Higher Order Function & Iterator Method in Collections. 🌟 Learning modern Java 8 concepts that make code more functional, readable, and efficient — plus mastering how to iterate cleanly using Java Collections. ☑️ Functional Interface : 🔅 A Functional Interface contains exactly one abstract method 🔅 It may include any number of default and static methods 🔅 Use @FunctionalInterface annotation to prevent adding more abstract methods 🧾 Syntax: @FunctionalInterface interface MyInterface { void myMethod(); } ☑️ Lambda Expressions : 🔅 Lambda Expressions are anonymous functions 🔅 Used to eliminate boilerplate code 🔅 Can be passed where a functional interface is expected 🧾 Syntax: (parameters) -> { // body } 🔷 Example: MyInterface ref = () -> System.out.println("Hello from Lambda!"); ref.myMethod(); ☑️ Higher Order Function : 🔅 A Higher Order Function accepts another function as an argument 🧾 Syntax Example : void executeFunction(MyInterface ref) { ref.myMethod(); } 🔷 Here, executeFunction() is a higher-order function ☑️ Iterator Method in Collections : 🔅 Used to traverse elements in collections like List, Set, etc. 🔷 Key Methods: 1️⃣ iterator() → Gets the Iterator object 2️⃣ hasNext() → Checks for remaining elements 3️⃣ next() → Retrieves next element 4️⃣ remove() → (Optional) Removes current element 🧾 Syntax : Iterator<String> it = list.iterator(); while(it.hasNext()) { System.out.println(it.next()); } 🫶 Special Thanks to : #DestinationCodegn.. Anand Kumar Buddarapu Sir , Saketh Kallepu Sir , Uppugundla Sairam Sir. #Java8 #FunctionalInterface #LambdaExpressions #HigherOrderFunction #Iterator #JavaCollections #120DaysOfLearning #JavaFullStack #CleanCode #CodeBetter #LearnJavaDaily
To view or add a comment, sign in
-
Day 9 of my #JavaWithDSAChallenge Today’s topic: Java Exception Handling Problem: Given two integers a and b, find the minimum value of a $ b where $ can be any arithmetic operation (+, -, *, /). We also need to handle division by zero using Exception Handling in Java. Key Concepts: try-catch block to handle runtime errors gracefully Arithmetic operations and Math.min() for comparisons Handling invalid division cases safely Code Snippet: class Solution { public int findMin(int a, int b) { int add = a + b; int sub = a - b; int mul = a * b; int div = Integer.MAX_VALUE; try { div = a / b; } catch (ArithmeticException e) { // Division by zero handled } int min1 = Math.min(add, sub); int min2 = Math.min(mul, div); return Math.min(min1, min2); } } Example: Input: a = 5, b = -5 Output: -25 Explanation: Among (0, 10, -25, -1), the minimum is -25. Learning: Exception Handling is not just about catching errors - it’s about writing safe and reliable code that doesn’t break in unexpected situations. #Java #CodingChallenge #DSA #LearningInPublic #100DaysOfCode #WomenInTech #JavaDeveloper
To view or add a comment, sign in
-
-
🚀 Day 76: Numerically Balanced Brute Force – Java Edition Today’s challenge was deceptively simple yet oddly satisfying: 🔢 Find the next numerically balanced number greater than a given integer. A number is numerically balanced if every digit d appears exactly d times. Examples: 22 → two 2s ✅ 1333 → one 1, three 3s ✅ 122 → one 1, two 2s ❌ (2 appears only once) I went full brute-force in Java, and it worked like a charm: java public int nextBeautifulNumber(int n) { for (int i = n + 1; i <= 1224444; i++) { if (isBalanced(i)) return i; } return -1; } private boolean isBalanced(int num) { int[] count = new int[10]; int temp = num; while (temp > 0) { count[temp % 10]++; temp /= 10; } for (int i = 0; i < 10; i++) { if (count[i] != 0 && count[i] != i) return false; } return true; } 🧠 Clean logic, no fancy tricks. Just a solid loop and a digit frequency check. 📌 Lesson: Sometimes brute force is enough—if you know your bounds and keep it clean. Let me know if you’ve tackled this one differently or optimized it further. #100DaysOfCode #Java #LeetCode #ProblemSolving #NumericallyBalanced #CodingJourney #Day76
To view or add a comment, sign in
-
-
Day(15/30) Today I practiced a simple yet logical Java problem: Find the largest word in a sentence. Here’s the logic in simple steps 1 Split the sentence into words using split(" ") 2 Loop through each word using index-based for loop 3 Compare each word’s length 4 Keep updating the longest word String sentence = "Java is a powerful programming language"; String[] words = sentence.split(" "); String largestWord = ""; int maxLength = 0; for (int i = 0; i < words.length; i++) { String word = words[i]; if (word.length() > maxLength) { maxLength = word.length(); largestWord = word; } } System.out.println("Largest Word: " + largestWord); This small exercise helped me understand string traversal and comparison in Java better. Sometimes, even simple problems teach powerful concepts like loops, arrays, and string handling. #Java #Programming #BCA #LearningInPublic #90DaysOfCode #CodingJourney
To view or add a comment, sign in
-
🚀 Day 39 of #100DaysOfCode – LeetCode Problem #917: Reverse Only Letters 💡 Problem Summary: Given a string s, reverse only the English letters while keeping all non-letter characters in their original positions. 📘 Examples: Input: s = "ab-cd" Output: "dc-ba" Input: s = "a-bC-dEf-ghIj" Output: "j-Ih-gfE-dCba" Input: s = "Test1ng-Leet=code-Q!" Output: "Qedo1ct-eeLg=ntse-T!" 🧠 Approach: Use two pointers: one starting from the beginning and one from the end. Move both pointers until they point to letters. Swap the letters and move inward. Skip over non-letter characters. 💻 Java Solution: class Solution { public String reverseOnlyLetters(String s) { char[] res = s.toCharArray(); int left = 0, right = res.length - 1; while (left < right) { if (!Character.isLetter(res[left])) { left++; } else if (!Character.isLetter(res[right])) { right--; } else { char temp = res[left]; res[left] = res[right]; res[right] = temp; left++; right--; } } return new String(res); } } ⚙️ Complexity: Time: O(n) Space: O(n) ✅ Result: Accepted (Runtime: 0 ms) 🎯 Key Takeaway: This problem highlights precision and attention to detail — even simple string manipulations can teach valuable lessons about pointer logic and conditional handling.
To view or add a comment, sign in
-
🚀 Day 102: Mastered Java Fundamentals — Data Types, String, Arithmetic & Logical Operators Today I focused on strengthening the core of Java — the building blocks that every backend/Java developer must master. 🔹 1. Data Types in Java Java is statically typed, meaning every variable must have a type. ✅ There are 8 primitive data types: TypeSizeExamplebyte1 bytebyte b = 10;short2 bytesshort s = 1000;int4 bytesint age = 21;long8 byteslong views = 100000L;float4 bytesfloat pi = 3.14f;double8 bytesdouble price = 89.99;char2 byteschar grade = 'A';boolean1 bitboolean isActive = true; 👉 Non-primitive types like String, Arrays, Classes store references instead of direct values. 🔹 2. String in Java Strings are not primitive — they are objects from the String class. ✨ Why are they special? Immutable (cannot be changed after creation) Stored in String Constant Pool to improve memory efficiency Thread-safe and used heavily in Java internals Common methods: name.length(); name.toUpperCase(); name.charAt(0); name.contains("Java"); 🔹 3. Arithmetic Operators Basic mathematical operations in Java: OperatorMeaning+Addition-Subtraction*Multiplication/Division%Remainder++ / --Increment / Decrement 🔹 4. Logical Operators Used in conditions and decision-making: OperatorMeaning&&Logical AND (true if both conditions are true)`!NOT (reverses the value) Example: if(age >= 18 && hasLicense) { System.out.println("You can drive!"); } ✅ Mastering these concepts builds a strong foundation for: OOP concepts Collections Exception Handling Spring Boot & Backend development Learning fundamentals pays off later. The deeper your basics → the stronger your code. #Java #Day102 #LearningInPublic #BackendDevelopment #100DaysOfCode #JavaDeveloper #DSA #ProgrammingJourney
To view or add a comment, sign in
-
More from this author
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development