In this video, we solve DS11: Search an Element in an Array using Java.
π You'll learn how to:
Read 'n' elements into an array
Search for a specific element
Return true if found, false if not
π§ Sample Input:
Array = {3, 8, 6, 2, 4, 7, 5, 9, 1, 10}
Search Element: 5
β Output: Search Found
Timestamps:
00:00:00 β 00:01:42 β Intro & What You'll Learn (Search an Element from an Array)
00:01:42 β 00:02:31 β Creating Scanner Object & Initializing the Array
00:02:31 β 00:03:24 β Element to be searched getting from an user
00:03:24 β 00:04:55 β Array declaration for n size
00:03:00 β 00:04:45 β For loop for iterating each array element for checking whether the each element is equal or not
00:04:45 β 00:06:13 β If else condition implemented and overall code explained step be step.
π Try it with your own inputs and let us know your result in the comments!
π‘ This is part of our Java Problem Solving Series on Code & Innovate where we build skills by solving real-world coding problems.
π Subscribe to our channel for more Java, Selenium, Frameworks, and Project-based tutorials!
πΊ Channel: Code & Innovate