Return Types in Java Methods Explained

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

  • diagram, timeline

To view or add a comment, sign in

Explore content categories