Day 4 of Learning Java : Today I started my journey into Java programming which is taught by Aditya Tandon Sir. Here are the key concepts I learned today: How Java Stores Negative And Floating Numbers? 1. Storing Negative Integers: Two’s Complement -- >Java doesn't just stick a "minus sign" in front of a number. Instead, it uses a system called Two’s Complement. In a standard 32-bit int, the most significant bit is the sign bit. • 0: Positive •1: Negative ∆ How to calculate Two's Complement: -->To store a negative number (like -5), Java follows these steps: 1.Start with the positive binary: 00000101 (for 5). 2.Invert the bits (One's Complement): 11111010. 3.Add 1: 11111011. 2. Storing Floating-Point Numbers: IEEE For float and double, Java follows the IEEE 754 standard. It stores numbers in a way similar to scientific notation but in binary. ∆ A 32-bit float is broken into three parts: 1.Sign Bit (1 bit): 0 for positive, 1 for negative. 2.Exponent (8 bits): Determines how large or small the number is (the "scale"). 3.Mantissa/Fraction (23 bits): Stores the actual digits of the number. This is just the beginning. Excited to continue this journey Special thanks to Rohit Negi bhaiya & Aditya Tandon Sir. #Day4 #Java #Coding #Learning #Consistency
Learning Java with Aditya Tandon Sir: Negative Numbers & Floating-Point
More Relevant Posts
-
Day 33 of Learning Java Today I learned about Return Types in Java methods, and it finally started to make sense how methods give results back! Here’s what I understood: 🔹 Every method has a return type 🔹 It tells what kind of value the method will give back 🔹 There are mainly two types: Primitive Data Types (PDT) : • byte • short • int • long • char • String • float • double • boolean Reference Data Types (RDT) : • Arrays • Classes • Interfaces • Annotations • Enums 🔹 A method can also return an object 🔹 The "return" keyword is used to send the value back 🔹 If nothing is returned, we use "void" Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #LearningJava #ProgrammingJourney #CodingLife #JavaBasics #SoftwareDevelopment #DeveloperJourney #TechLearning #StudentLife
To view or add a comment, sign in
-
-
Day 12 of Learning Java Today I learned something small in Java that actually plays a big role in programming — Type Casting. At first, I thought it was complicated. But the idea is actually simple. Sometimes in programming, we need to convert one data type into another. For example, converting an `int` into a `double`. That process is called Type Casting. Java mainly has two types of type casting: - Implicit Casting (Widening) This happens automatically when converting a smaller data type into a larger one. Example: `int → double` - Explicit Casting (Narrowing) This is done manually when converting a larger type into a smaller one. Example: `double → int` Simple example: int num = 10; double result = num; // implicit casting double price = 19.99; int rounded = (int) price; // explicit casting What I’m realizing while learning Java is that even small concepts build the foundation of programming logic. Slowly learning. Step by step. #JavaLearning #LearningInPublic #CodingJourney #JavaProgramming #WomenInTech
To view or add a comment, sign in
-
Day 39 of learning java Today I learned something very important in Java, Object Creation. Syntax: "className objectName = new constructor();" Here’s what I understood: • The left side ("className objectName") is just declaring a reference variable. • The right side ("new constructor()") is where the actual object is created. • Memory is allocated only when we use the "new" keyword. • The constructor gets executed automatically when the object is created. • Without "new", no memory is allocated and no constructor runs. In short: Declaration != Object creation You need "new" to actually create and use the object. This concept made things much clear about how Java handles memory and execution internally. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #LearningJourney #Programming #JavaBasics #CodingLife #DeveloperJourney #TechLearning #Beginners #CodeNewbie #jvm #SoftwareEngineer #StudentLife
To view or add a comment, sign in
-
-
Day 37 of Learning Java Today I learned something interesting Illegal Forward Reference in Java. At first, it sounded complicated, but once I understood it, it actually made a lot of sense! Here’s what I learned: 🔹 What is Illegal Forward Reference? • It happens when you try to use a variable before it is declared. • Java doesn’t allow referencing a variable that comes later in the code. 🔹 Why does it happen? • Java reads code from top to bottom. • If a variable is used before it exists, the compiler throws an error. 🔹 Example of the issue: • Using a variable before declaring & defining it to a compile-time error. 🔹 How to fix it? • Always declare variables before using them. • we have to call static variable using ClassName.VarName. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #LearningJava #CodingJourney #Programming #DeveloperLife #CodeNewbie #JavaDeveloper #TechLearning #StudentLife #jvm
To view or add a comment, sign in
-
-
📘 Day 43 of My Learning Journey Today, I learned about the equals() method from the java.lang package in Java. 🔹 The equals() method is used to compare two objects for equality. 🔹 By default, it checks whether both objects refer to the same memory location. 💡 But the real power comes when we override equals() to compare object values instead of references. 👉 Example: Two objects with the same data (like two students with the same ID) can be treated as equal using equals(). 🔸 This concept is very important when working with collections like lists, sets, and maps. 🚀 Understanding equals() helps in writing accurate comparisons and avoiding logical errors in Java programs. Step by step, improving my Java skills and writing better code! 💻 #Java #LearningJourney #Day43 #OOP #Programming #TechSkills
To view or add a comment, sign in
-
-
Day 3 of Learning Java : Today I started my journey into Java programming which is taught by Aditya Tandon Sir. Here are the key concepts I learned today: Variables And Data Types In Java. Variables: The Containers A variable is a reserved memory location to store values. To create one, you follow this basic formula: type name = value; Value can be changed. Data Types Java splits data types into two main categories: Primitive and Non-Primitive. Primitive Data types Integer:- •byte •short •int •long Floating Point:- •float •double Character:- •char Logical:- •boolean Non-Primitive Data Types:- •Strings •Arrays •Classes & Interfaces This is just the beginning. Excited to continue this journey Special thanks to Rohit Negi bhaiya & Aditya Tandon Sir. #Day3 #Java #Coding #Learning #Consistency
To view or add a comment, sign in
-
-
Day 27 of learning java Today I learned about Java Generics 🔹 Why Generics? Java is strongly typed Using Object causes: • Type casting (unsafe) • Runtime errors (ClassCastException) 👉 Generics solve this → type safety at compile time 🔹 Basic Concept Use <T> to define type Works for class, method, interface Example idea: Box<T> → can store any type safely 🔹 Benefits ✔ No explicit casting ✔ Compile-time error checking ✔ Reusable code 🔹 Generic Methods Methods can have their own <T> Works independently of class type 🔹 Bounded Types (extends) 👉 Restrict allowed types Example idea: <T extends Number> ✔ Only accepts: Integer, Double, Float, etc ❌ Not String 🔹 Key Understanding ✔ Generics = type safety + flexibility ✔ Prevents runtime errors ✔ extends = upper bound restriction Special thanks to Aditya Tandon , CoderArmy , Rohit Negi sir
To view or add a comment, sign in
-
-
Day 41 of Learning Java: Method Overriding If method overloading was about flexibility,method overriding is about customization. What is Method Overriding? It’s when a subclass provides its own implementation of a method that is already defined in the parent class. Same method name. Same parameters. But different behavior. 🔹 Simple example- class Parent { void watchTV() { System.out.println("Watching News/Serial"); } } class Child extends Parent { @Override void watchTV() { System.out.println("Watching Music/Sports"); } } Same method → different output depending on the object. • Parent defines a general behavior • Child modifies it based on its own need • This helps in writing more flexible and reusable code 🔹 Key points to remember • Method signature must be the same • Happens during runtime (runtime polymorphism) • Inheritance is required 👉 You cannot override: static methods private methods final methods 🔹 One important concept Parent ref = new Child(); ref.watchTV(); Even though the reference is of Parent, the method of Child gets executed. 👉 This is called dynamic method dispatch 🔹 About @Override It’s not mandatory, but it helps: ✔ Avoid mistakes ✔ Makes code more readable ✔ Ensures you’re actually overriding #Java #OOP #MethodOverriding #LearningInPublic #Programming#sql #branding
To view or add a comment, sign in
-
-
Day 5 of Learning Java : Today I started my journey into Java programming which is taught by Aditya Tandon Sir. Here are the key concepts I learned today: Type Conversation In Java:- In Java, "type conversion" is the process of changing a value from one data type to another. 1. Implicit Type Conversation • This happens automatically when we pass a value from a smaller primitive datatype to a larger primitive datatype. Because we are moving to a "bigger container," there is no risk of losing data. ∆ The Hierarchy: byte → short → char → int → long → float → double 2. Explicit Type Conversation • This must be done manually by placing the type in parentheses ( ) in front of the value. This is used when moving from a larger type to a smaller type. • It can loss the data. (e.g., losing decimals or overflowing). ∆ The Hierarchy: double → float → long → int → char → short → byte This is just the beginning. Excited to continue this journey Special thanks to Rohit Negi ne bhaiya & Aditya Tandon Sir. #Day5 #Java #Coding #Learning #Consistency
To view or add a comment, sign in
-
-
#Day28 of learning Java from Aditya Tandon CoderArmy Topic: Generics ➤ Invariance → List<Integer> ≠ List<Number> ➤ Wildcards (?) → make generics flexible Types: • <?> → unknown type • <? extends T> → upper bound (read-only) • <? super T> → lower bound
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