Understanding the First Two Types of Methods in Java In Java, methods help avoid writing all logic inside the main method by separating functionality into reusable blocks of code. Among them, the first two basic types are: 🔹 Methods with no input and no output These methods do not take any parameters and do not return any value. They are mainly used to perform actions such as displaying messages or executing fixed tasks. 🔹 Methods with no input but with output These methods do not accept parameters but return a value. The returned result can be stored or used by the calling method, making the code more reusable and structured. Using these methods keeps the program clean, readable, and aligned with good programming practices. Main method initiates execution; methods perform the work. 🚀 hashtag #Java #Methods #OOP #Programming #LearningJava #CleanCode #SoftwareDevelopment
Java Methods: No Input, No Output and No Input with Output
More Relevant Posts
-
Method Overloading in Java – Simplified! Method Overloading is a powerful feature in Java that allows a class to have multiple methods with the same name but different parameters. This helps improve code readability and flexibility. 🔹 Example: We can create multiple "add()" methods: - "add(int a, int b)" - "add(double a, double b)" Java automatically decides which method to call based on the arguments passed. 🔹 Type Promotion in Overloading: When no exact match is found, Java promotes smaller data types to larger ones: byte → short → int → long → float → double Method Overloading makes code cleaner, reusable, and easier to maintain — a must-know concept for every Java developer! #Java #Programming #OOP #MethodOverloading #JavaDeveloper #Coding #LearningJava
To view or add a comment, sign in
-
-
Marker Interface in Java In Java, a Marker Interface is a special type of interface that does not contain any methods or fields. It is used to provide metadata or special information to the JVM or compiler about a class. Marker interfaces act like a tag that tells Java that a class has a particular property or behavior. ✅ Why Are Marker Interfaces Important? Marker interfaces are mainly used to: Enable special runtime behavior Indicate that a class belongs to a specific category Support built-in Java features like object serialization and cloning 🔍 Common Examples Some well-known marker interfaces in Java include: Serializable Cloneable Remote 🚀 Conclusion Marker interfaces play an important role in Java by providing a simple way to add meaning and functionality to classes without adding extra code. ✨ Grateful for the support and collaboration from: 🔸 Anand Kumar Buddarapu Sir 🔸 Uppugundla Sairam Sir 🔸 Saketh Kallepu Sir #Java #CoreJava #MarkerInterface #OOP #JavaProgramming #LearningJava #SoftwareDevelopment
To view or add a comment, sign in
-
-
## Just wrapped up an incredibly detailed YouTube playlist on Java Multithreading: Synchronization, Locks, Executors, Deadlock, CountdownLatch & CompletableFuture. # Here are some of my key takeaways: 1. What is Multithreading? It's the concurrent execution of multiple threads (smaller units of a process) for maximum CPU utilization and smoother app performance. 2. Core Concepts I Learned: - Threads and processes can execute truly in parallel across cores using the OS scheduler. - Daemon Threads are background tasks the JVM doesn't wait for when shutting down. - Synchronization ensures safe access to shared resources, preventing race conditions using locks. - Reentrant Locks offer manual control and fairness policies, perfect for fine-tuned concurrency. - Thread Safety ensures consistent and correct data handling across concurrent executions. 3. Executors Framework (introduced in Java 5) - Executor - ExecutorService - ScheduledExecutorService It allows us to submit tasks, schedule jobs, and manage thread pools efficiently, improving performance and scalability. => Also explored CountDownLatch, CyclicBarrier, and CompletableFuture - some of the most elegant tools for coordination and asynchronous programming in Java. A big thanks to Vipul Tyagi Sir for this goldmine of a video. 🙏 If you're diving into advanced Java or preparing for interviews, I'd highly recommend checking it out! #Java #Multithreading #Executors #Concurrency #LearningJourney #CompletableFuture #CountDownLatch #CyclicBarrier #JavaDevelopers #ThankfulPost
To view or add a comment, sign in
-
-
I worked on a Java program to understand how constructors initialize objects in Object-Oriented Programming. 💻☕ In this project, I created a class Pen with different constructors to explore how object creation works with various inputs: • Used a no-argument constructor for default object creation 🧩 • Implemented parameterized constructors to pass values during object creation 📥 • Observed how constructor arguments influence object initialization 🔍 • Printed object references to understand default Java object representation 🖨️ This helped me build clarity on: • Object instantiation in Java ⚙️ • Role of constructors in initialization 🏗️ • Difference between object reference and actual data 🧠 A focused exercise to strengthen core Java fundamentals. 🚀 #Java #OOP #Constructors #JavaProgramming #CodingJourney #LearningJava #Developers
To view or add a comment, sign in
-
-
What is Garbage Collection in Java 🤔 Many developers use Java daily, but memory management often stays a mystery Here’s the simple truth Garbage Collection (GC) → JVM automatically removes objects that are no longer referenced Why it matters → Prevents memory leaks, keeps apps stable, avoids OutOfMemoryError String name = new String("Java"); name = null; // old object now eligible for GC Key Points ======= Object with no references → eligible for GC Eligible ≠ immediately deleted → JVM decides timing Most objects in Java apps are cleaned automatically → you focus on building features Rule of Thumb Stateless objects → no GC worries Heavy object creation → can trigger frequent GC, impacts performance Understanding GC = writing efficient, scalable Java code #Java #InterviewSeries #LearnJava #BackendDevelopment #JavaDeveloper #CodingTips #Programming #JavaInterviewPrep #TechLearning #DeveloperTips
To view or add a comment, sign in
-
What is Garbage Collection in Java 🤔 Many developers use Java daily, but memory management often stays a mystery Here’s the simple truth Garbage Collection (GC) → JVM automatically removes objects that are no longer referenced Why it matters → Prevents memory leaks, keeps apps stable, avoids OutOfMemoryError String name = new String("Java"); name = null; // old object now eligible for GC Key Points ======= Object with no references → eligible for GC Eligible ≠ immediately deleted → JVM decides timing Most objects in Java apps are cleaned automatically → you focus on building features Rule of Thumb Stateless objects → no GC worries Heavy object creation → can trigger frequent GC, impacts performance Understanding GC = writing efficient, scalable Java code #Java #InterviewSeries #LearnJava #BackendDevelopment #JavaDeveloper #CodingTips #Programming #JavaInterviewPrep #TechLearning #DeveloperTips
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
-
-
Core Java Learning | String Immutability & Memory Allocation Explored the String concept in Java, with a focus on immutability and how memory is allocated. Key takeaways: 1. String objects are immutable, meaning their value cannot be changed once created. 2. String literals are stored in the String Constant Pool (SCP) to optimize memory usage and improve performance. 3. Strings created using the new keyword are stored in the heap memory, even if the same value exists in the SCP. 4. When a String object is modified, a new object is created, and the original object remains unchanged. Understanding how Strings are allocated between the constant pool and heap helps in writing memory-efficient and secure Java applications. Sharath R Harshit T #CoreJava #JavaStrings #Immutability #JavaMemory #LearningJourney #SoftwareDeveloper
To view or add a comment, sign in
-
-
Hello LinkedIn! Today I focused on understanding Methods in Java, which help in writing reusable and organized code. 📌 What I learned today: ✅ What is a Method? ✅ Method Syntax & Structure ✅ Parameters and Return Types ✅ void vs return methods ✅ Calling methods in a program Methods make programs cleaner, reusable, and easier to maintain. Step by step, improving my Java fundamentals and moving closer to becoming a better developer 💻🔥 Consistency + Practice = Progress 🚀 #Java #OOP #Methods #Programming #LearningJourney #Developer
To view or add a comment, sign in
-
-
🚀 Day 18 | Java Arrays – Core Java Learning Today, I learned about Arrays in Java, a fundamental data structure used to store multiple values of the same data type efficiently. 🔹 What is an Array? An array is an object in Java that allows storing multiple values under a single variable name. 🔹 Key Points Covered: Arrays store elements of same data type. Types of arrays in Java: 1D Array 2D Array 3D Array Difference between: Regular Arrays (equal number of columns) Jagged Arrays (unequal number of columns) 🔹 Array Declaration Syntax: dataType[] arrayName; 🔹 Example: int[] a; 🔹 Accessing Elements: 1D: a[3] 2D: a[1][0] 3D: a[1][0][2] ✨ Arrays help in writing clean, structured, and efficient code and are widely used in real-world applications. #Day18 #Java #ArraysInJava #CoreJava #Programming #TapAcademy #LearningJourney #SoftwareDeveloper
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