Reflecting on a fundamental concept today: the journey from struct in C to class in Java! 💡 I was thinking about how C's struct allowed us to group related data, providing a powerful way to organize information. But then, the jump to class in Java introduced a revolutionary idea: not just grouping data, but also encapsulating the functions (methods) that operate on that data. This isn't just about syntax; it's a paradigm shift. Classes enable us to model real-world entities much more closely, where data and its behavior are inherently linked. It brings us closer to the principles of Object-Oriented Programming, promoting better organization, reusability, and maintainability in our code. It's a beautiful evolution in how we think about and structure our programs. What are your thoughts on this progression? #Programming #C #Java #OOP #SoftwareDevelopment #Structs #Classes #Tech Here's an image that visualizes this concept generated by Gemini :
From C's struct to Java's class: A paradigm shift in OOP.
More Relevant Posts
-
🚀 Day 109: Today I Learned About Abstraction in Java Today I explored one of the core pillars of Object-Oriented Programming — Abstraction. 🔍 What is Abstraction? Abstraction means showing only the essential details and hiding the complex internal logic. Just like how we use a phone without knowing how the internal circuits work — in programming, abstraction helps us focus on what something does, not how it does it. 💡 Why is it useful? Makes code cleaner and easier to understand Hides unnecessary complexity Improves security by exposing only required features Helps in building scalable and maintainable systems 🧩 In Java: We achieve abstraction using: Abstract Classes Interfaces ✨ Learning abstraction helped me understand how real-world systems hide complexity and provide simple interfaces for users. Excited to dive deeper into OOP concepts! 🔥 #Java #OOPs #Abstraction #LearningInPublic #100DaysOfCode #Day109 #CodingJourney
To view or add a comment, sign in
-
-
🧩 Day 79 of #100DaysOfCode Today’s problem: LeetCode 3370 – Smallest Number With All Set Bits 💡 The challenge was to find the smallest number greater than or equal to n whose binary representation contains only set bits (1s). 💻 Language: Java ⚙️ Approach: Used bitwise operations to identify numbers whose binary form contains all 1s. The key condition used: (x & (x + 1)) == 0 This ensures that the number has all bits set. ✅ Result: Runtime – 0 ms, beating 100% of Java submissions! ⚡ 📈 Learning: This problem improved my understanding of bit manipulation and binary operations — core concepts for optimizing code performance. #Day79 #LeetCode #100DaysOfCode #CodingChallenge #JavaProgramming #ProblemSolving #BitManipulation #DeveloperJourney #CodeEveryday
To view or add a comment, sign in
-
-
📌 Day 12/100 - Concatenation of Array (LeetCode 1929) 🔹 Problem: Given an integer array nums, create a new array ans such that: ans[i] = nums[i] ans[i + n] = nums[i] where n is the length of nums. In short, we need to concatenate the array with itself to form a new array of size 2n. 🔹 Approach: First, determine the length n of the array. Create a new array newArray of size 2n. Loop through nums once: Assign each element twice — once at position i and once at position i + n. Finally, return the concatenated array. 🔹 Key Learning: Reinforced the concept of array indexing and iteration. Practiced efficient array manipulation in Java. Sometimes, the simplest logic is the cleanest — clarity beats complexity! 💡 Every solved problem adds a layer of confidence and consistency 💪 #100DaysOfCode #LeetCode #Java #ProblemSolving #DSA #CodingJourney #LearnByDoing
To view or add a comment, sign in
-
-
🚀 Day-74 of #100DaysOfCodeChallenge 💡 LeetCode Problem: 3370. Smallest Number With All Set Bits (Easy) 🧠 Concepts Practiced: Bit Manipulation, Binary Representation, Logical Thinking Today’s challenge was short but conceptually sharp — finding the smallest number ≥ n whose binary representation consists only of 1’s (all set bits). This problem tested understanding of bit patterns and how to efficiently generate numbers with consecutive set bits using bitwise logic. 🔹 Key Idea: Keep generating numbers of the form (1 << k) - 1 (which gives 111...1 in binary) until we find one greater than or equal to n. It’s a neat example of how mathematical patterns meet binary logic in programming! ⚙️ ⚙️ Language: Java ⚡ Runtime: 0 ms (Beats 100.00%) 💾 Memory: 40.59 MB (Beats 87.17%) ✅ Result: 608 / 608 test cases passed — Accepted 🎯 Every problem, no matter how simple, reinforces that clarity in logic is the foundation of clean code 💪 #100DaysOfCode #LeetCode #Java #CodingChallenge #BitManipulation #BinaryLogic #ProblemSolving #Programming #DeveloperJourney #LearningEveryday #TechMindset #CleanCode
To view or add a comment, sign in
-
-
💡 Learning Multithreading and Concurrency in Java Lately, I’ve been diving deep into multithreading and concurrency — and honestly, it’s one of those topics that really changes how you think about programming. At first, it felt complex — threads, synchronization, race conditions — everything seemed abstract. But as I explored real-world scenarios like handling multiple user requests, parallel processing, and async operations, I started connecting the dots. 🔹 I learned why CPU-intensive tasks need threads equal to cores, 🔹 why I/O-bound tasks can have more threads, 🔹 and how Project Loom is simplifying concurrency with lightweight threads. The most interesting part? Seeing how multithreading directly improves performance, scalability, and responsiveness in backend systems. Next, I plan to work on a small project to apply these concepts practically — maybe simulate concurrent API calls or build a task scheduler using ExecutorService. Every time I dig deeper into Java, I realize there’s always more to uncover. 🚀 #Java #Multithreading #Concurrency #LearningJourney #BackendDevelopment #SDE2Prep
To view or add a comment, sign in
-
🚀 Day 53 | DSA with Java Today, I solved the Aggressive Cows Problem — another classic example of Binary Search on Answers. 🐄🏠 --- 🔹 Problem Statement: Given n stalls at different positions and c cows: Place the cows in stalls so that the minimum distance between any two cows is maximized. Find the largest minimum distance possible. Example: Input: stalls = [1,2,4,8,9], c = 3 Output: 3 ✅ (Place cows at positions 1, 4, 8) --- ⚙️ Approach – Binary Search on Answers 1. Sort the stalls array. 2. Search in the distance range [1, max(stalls) - min(stalls)]. 3. For each mid distance, check if it’s possible to place all cows maintaining at least mid distance. 4. Adjust the search space based on feasibility: If possible → try larger distance Else → try smaller distance Time Complexity: O(n × log(maxDistance)) Space Complexity: O(1) --- 🧠 Learning Outcomes: ✅ Practiced Binary Search on Answers in a spatial context ✅ Strengthened logical thinking with feasibility functions ✅ Similar patterns as Book Allocation and Painters Partition --- #DSA #Java #BinarySearch #AggressiveCows #ProblemSolving #Coding #Programming #100DaysOfCode #GitHub #LogicBuilding
To view or add a comment, sign in
-
-
💡 Day 14 of My Java Learning Journey ☕ Today was all about connecting the dots between operators, loops, and functions — three pillars that form the base of every Java program. 🔍 Here’s what I explored today: Bitwise, Increment-Decrement, and Assignment Operators ⚙️ — getting comfortable with how each affects data at the memory level. The power of for loops, break, and continue — learning how to control program flow effectively. Practiced problems like Fibonacci series, checking prime numbers, and finding Nth terms in a sequence. Deep dive into Functions — from return types and parameter passing (pass by value) to real-world function usage. Revisited Variables and Scopes — truly understanding how lifetime and accessibility affect program behavior. 🧠 Each topic might look simple, but combining them gave me a better sense of how Java logic works as a system. Every loop, every variable, and every function connects like puzzle pieces. 🚀 Small progress every day builds strong foundations — and I’m slowly starting to think like the compiler! #Java #LearningInPublic #CodingJourney #100DaysOfCode #DevelopersCommunity #CodeNewbie #Programming #SoftwareDevelopment #NamasteJava #WomenWhoCode #TechJourney
To view or add a comment, sign in
-
29/30 days ✅ Solved a LeetCode Problem #231 Power of Two — Bit Manipulation Logic in Java Solved the Power of Two problem on LeetCode! The challenge is to determine whether a given integer n is a power of two. The key insight lies in understanding the binary representation of numbers that are powers of two — they contain exactly one set bit (1). So, when we perform the operation n & (n - 1), it turns off the only set bit of n. For any power of two, this result becomes 0. Therefore, the condition n > 0 && (n & (n - 1)) == 0 accurately checks if a number is a power of two. This simple yet powerful bitwise trick is both efficient and elegant — a great reminder of how understanding binary operations can make problem-solving in programming much faster! ⚡ #Java #LeetCode #ProblemSolving #BitManipulation #CodingJourney #LearningEveryday
To view or add a comment, sign in
-
-
🔥 Day 17 of My LeetCode Journey — Problem #377: Combination Sum IV (Dynamic Programming) Today’s focus was on Dynamic Programming — specifically tackling problems where order matters in combinations. 🧩 Problem Summary: Given an array of distinct integers and a target integer, the task was to compute the number of possible combinations that sum up to the target. 💡 Approach & Key Insights: Utilized bottom-up Dynamic Programming (1D array approach) to efficiently compute results. Base case: dp[0] = 1, representing one way to reach a sum of zero. Iteratively built combinations where the sequence order impacts the outcome, differentiating it from subset problems. ⚙️ Algorithmic Complexity: Time: O(n × target) Space: O(target) 📈 Performance Outcome: ✅ Accepted Solution ⚡ Runtime: 1 ms (Beats 67.14% of Java submissions) 💾 Memory: 41.19 MB Each day’s challenge continues to refine my analytical reasoning and problem-solving efficiency, bringing me one step closer to mastering algorithmic design patterns in Java. #LeetCode #Java #DynamicProgramming #CodingJourney #ProblemSolving #TechLearning #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀My First Java Project :- Compound Interest Calculator 💻 I just build a simple Compound Interest Calculator using Java to practice user input handling and mathematical operations. ⚙️Features: ✅ Takes principal amount, interest rate, number of compounding periods, and time (in years) as user inputs. ✅ Calculates the final amount using the compound interest formula: A = P × (1 + r/n)^(n × t) ✅ Use Scanner class for console input and Math.pow() for exponential operations. ✅ Displays formatted output using System.out.printf() for precision. 🎯Used tech concepts:Java I/O,Math class(Math.pow()) 💰A great exercise to strengthen Java basics and understand real-world financial computations! GitHub Link : https://lnkd.in/dt47_zn3 #JavaDevelopment #SoftwareEngineering #JavaProjects #Java #Programming #LearningJourney #Coding #StudentProjects #SoftwareDevelopment #CompoundInterest #GitHubProjects #ObjectOrientedProgramming
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
Whenever I teach OOP, C++ or java based, struct in C is the reference point to class and objects.. Data+functions as a single unit with data privacy added.. That is the basic difference between struct in C and classes and objects in C++, java etc.