🚀 Implemented Toggle Bits Logic in Java As part of my Java practice, I developed a program to understand how bit manipulation works, specifically focusing on toggling bits of a number. 🔹 What is Toggle Bits? Toggle bits means changing every binary digit of a number: 0 becomes 1 1 becomes 0 In simple terms, it performs a binary complement of a number. 🔹 What I Implemented: ✔ Converted a decimal number into binary form logically ✔ Reversed each bit (0 → 1, 1 → 0) ✔ Reconstructed the new decimal value from the toggled binary ✔ Handled edge cases like input 0 Bit manipulation is powerful because it works directly at the binary level, making programs faster and more memory-efficient. Excited to explore more concepts in Java and improve my problem-solving skills! 💻✨ #Java #BitManipulation #Programming #CodingJourney #Learning #Developer
More Relevant Posts
-
💡 Java Strings Decoded: Memory, Mutability & Logic Ever wondered what really happens when we create a String in Java? 🤔 Here’s a quick breakdown of the concept I explored today: 🔹 Strings are immutable – once created, their value cannot be changed. Any modification creates a new object. 🔹 String Constant Pool (SCP) helps optimize memory by storing only one copy of identical string literals. 🔹 Using new String("Java") creates a new object in the heap, even if the same value already exists in the pool. 🔹 == compares memory addresses, while .equals() compares the actual content of strings. Understanding how Java manages strings helps us write more efficient and optimized code. Always learning, always improving 🚀 #TapAcademy #Java #JavaDeveloper #Programming #Coding #LearningInPublic #SoftwareDevelopment #FullStackDeveloper
To view or add a comment, sign in
-
-
#Day17 – Understanding Constructors in Java ⚙️ Today’s session helped me understand how constructors work in Java and how they are used while creating objects. Key Learnings: ✔ A Constructor is a special type of method whose name is the same as the class name ✔ Constructors do not have any return type, not even void ✔ Constructors are automatically called when an object is created using the new keyword ✔ If a programmer does not create any constructor, Java Compiler provides a Default Constructor ✔ Learned about Parameterized Constructors and Zero-Parameterized Constructors ✔ Understood Constructor Overloading (multiple constructors with same name but different parameters) ✔ Explored Constructor Chaining using this(), where one constructor calls another constructor within the same class TAP Academy Harshit T #Java #OOPS #CoreJava #Constructors #Programming #SoftwareDevelopment #LearningJourney #Consistency
To view or add a comment, sign in
-
-
Day 22-What I Learned In a Day(JAVA) Today I learned about method calling in Java. I practiced how a method can be called multiple times from the main() method. I also understood that when calling a method, we can pass arguments in two ways: 1️⃣ Directly passing values m1(10); 2️⃣ Passing values through a variable int a = 10; m1(a); Both approaches will pass the value to the method parameter and execute the method. Through this practice, I improved my understanding of method creation, parameter passing, and method execution flow in Java. Hashtags Practiced 👇 #Java #CoreJava #JavaLearning #Programming #CodingJourney #JavaMethods #LearnJava #Developers #TechLearning #DailyLearning
To view or add a comment, sign in
-
💻 Finding the Maximum Value in an Array using Java Scanner Today I practiced a simple yet important Java concept — taking user input dynamically and processing it to solve a real problem. 🔍 Problem Statement: Find the maximum number present in a given array using user input. 🛠️ Approach: - Used "Scanner" to take input from the user - Stored elements in an array - Initialized the first element as "max" - Compared each element to find the largest value 📌 Key Learning: Understanding how to handle user input and iterate efficiently through arrays is a fundamental skill for any Java developer. ✅ Output Example: Input: 100, 300, 600, 1000, 30 Output: Maximum Value = 1000 🚀 Small steps like these build a strong foundation in problem-solving and coding logic. #Java #Programming #Coding #DeveloperJourney #100DaysOfCode #JavaBasics #ProblemSolving
To view or add a comment, sign in
-
-
♻️ Why should you always close Scanner in Java? Scanner is used to read input, from the console, a file, or a stream. But a lot of beginners (including me, early on) never bother closing it after use. Here's why that's a problem: ->it holds onto system resources even after your program is done with them ->for file-based Scanners, it can lock the file or cause data not to be flushed properly ->in larger programs, unclosed Scanners can quietly lead to resource leaks The fix is simple, either call: ✔️ sc.close() at the end ✔️ or use a try-with-resources block so Java closes it automatically While practicing Java basics, I realized the code worked either way… but one way was responsible, and the other wasn't. That's something no compiler warning will tell you. Writing correct code and writing clean, responsible code are two different things. Learning the difference early makes you a better developer. Learning in public, improving step by step 🤍 #Java #ResourceManagement #LearningInPublic #Programming
To view or add a comment, sign in
-
Week 3 - Day 16 : Vector in java A vector in java is a part of the java.util.package and is one of the legacy classes in java that implements the list interface. Key features of an vector : 1) Dynamic Array : Like Arraylist, Vector is a Dynamic array that grows automatically when more elements, are added then the current capacity. 2) Synchronized : All the methods in vector are Synchronized, which make it thread safe .This means multiple thread can work on a vector without the risk of corrupting the data. 3) Legacy class : Vector was part of java original release and is considered legacy class. It's generally recommended to use Arraylist in single thread environments due to performance consideration. 4) Resizing mechanism : When the current capacity of the vector is exceeded, it doubles it's size by default. 5) Random Access : Similar to arrays and Arraylist, vector allows random access to elements, making it efficient for accessing elements using an index . #java #programming #javacore #vector #learning EchoBrains
To view or add a comment, sign in
-
-
🔹 Java Practice: Frequency Count + Single Number Detection 🔹 Today I practiced a small but useful Java problem: counting the frequency of elements in an array and also identifying the element that appears only once. In this program, I used a boolean array to mark elements that were already processed so that duplicates are not counted multiple times. For each element, I compared it with the remaining elements, increased the count when matches were found, and marked those positions as visited. This approach helped me achieve two things in one pass of logic: ✔️ Print how many times each number occurs ✔️ Detect and display the number that appears only once Working on such problems strengthens understanding of loops, conditions, arrays, and basic problem-solving logic in Java. Small exercises like these build the foundation for writing efficient algorithms later. #Java #Programming #CodingPractice #DataStructures #Learning #StudentDeveloper
To view or add a comment, sign in
-
-
Day-11🚀 Comparing Strings in Java – Key Methods Explained! Understanding how to compare strings correctly in Java is essential for writing clean and bug-free code. Here’s a quick breakdown of the most important methods: 🔸 == Operator – Compares memory references (checks if both variables point to the same object). 🔸 equals() Method – Compares the actual content of strings. 🔸 compareTo() Method – Performs lexicographical (dictionary-order) comparison and returns a positive, negative, or zero value. 🔸 equalsIgnoreCase() Method – Compares content while ignoring case differences. 💡 Key Takeaway: Use equals() for content comparison, == for reference checks, compareTo() for sorting logic, and equalsIgnoreCase() when case sensitivity doesn’t matter. Consistency + Practice = Progress! 💻✨ #Java #Programming #Coding #Learning #SoftwareDevelopment #TapAcademy
To view or add a comment, sign in
-
-
🚀 Day 25 of My Java Learning Journey Today I learned about the Object Class in Java and its important methods. 🔹 The Object class is the parent of all classes in Java. 🔹 toString() is used to convert an object into a readable string format. 🔹 clone() is used to create a copy of an object. 🔹 Java is not a purely object-oriented language because it uses primitive data types like int, char, and float. 🔹 Wrapper classes such as Integer, Double, and Character help convert primitive types into objects. Example: Employee e = new Employee(); System.out.println(e); Internally, Java calls: e.toString(); Every day I am improving my Java skills step by step 💪 Consistency + Practice = Growth 📈 #Java #ObjectOrientedProgramming #Programming #LearningJourney #100DaysOfCode #SoftwareDevelopment
To view or add a comment, sign in
-
-
Strengthening My Java Fundamentals! While learning Java, I explored the differences between: 🔹 String 🔹 StringBuffer 🔹 StringBuilder 🔹 StringTokenizer Here’s what I understood: ✅ String – Immutable (cannot be changed once created). Efficient for fixed data but creates new objects when modified. ✅ StringBuffer – Mutable and Thread-Safe. Best for multi-threaded environments where data consistency is important. ✅ StringBuilder – Mutable but Not Thread-Safe. Faster than StringBuffer and suitable for single-threaded applications. ✅ StringTokenizer – Used to break a string into tokens (words) based on delimiters. Understanding these concepts helped me improve my knowledge about memory management, performance optimization, and multithreading behavior in Java. #Java #CoreJava #LearningJourney #Programming #SoftwareDevelopment
To view or add a comment, sign in
-
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