Yash Panchal’s Post

🎉 Day 31 of My Java Learning Journey 🎂 Reverse an Array in Java 🔄☕. Today, I explored one of the most common yet important interview topics Reversing an Array! It’s simple in concept but powerful in understanding how arrays work under the hood. 🧩 Concept: Reversing means swapping elements from start to end the first becomes last, the second becomes second-last, and so on. Last night, I was debugging a loop that printed my array backward by mistake 😅 and that’s when I realized, it’s actually a perfect way to reverse an array! So I wrote my own logic and it worked perfectly 💪 💡 Code Logic: int[] arr = {10, 20, 30, 40, 50}; int start = 0, end = arr.length - 1; while (start < end) { int temp = arr[start]; arr[start] = arr[end]; arr[end] = temp; start++; end--; } System.out.println(Arrays.toString(arr)); 🎯 Keep experimenting small codes teach big concepts! Consistency in learning always pays off in your Java journey. 🌱 #Java #AccessModifiers #JavaLearning #CodingJourney #BackendDevelopment #JavaDeveloper #OOP #CodeSecurity #LearnInPublic #100DaysOfCode #TechCareer #ProgrammingTips #SoftwareEngineering #DevelopersJourney #CodeBetter #JavaProgramming #CleanCode #SpringBoot #BackendEngineer #Maang #Consistency #Motivation #Hustle #Google #CarrierGoal

  • graphical user interface

To view or add a comment, sign in

Explore content categories