error: reached end of file while parsing SOLVED in Java

error: reached end of file while parsing SOLVED in Java


error: reached end of file while parsing SOLVED in Java

How to solve error: reached end of file while parsing in java is shown


Content

0.42 -> hey everyone in this video I'll be showing you  how to solve the error reached end of file while  
6.18 -> parsing in Java so let's get started so first  let me explain you why this error is caused and  
11.64 -> the solution for the error so this error is caused  because we have forgotten to give a ending bracket  
17.22 -> for your main class or your main program in Java  so in Java the count of brackets should be always  
23.88 -> an even number because every closing bracket  should have a corresponding opening bracket so  
28.98 -> here you can see my count of brackets is 1 2 3  4 5 okay and here you can see a red line so the  
37.26 -> count is odd it's odd number and which means  that I have missed a bracket so if I just now  
42.72 -> add a bracket over here the count becomes even  and it now works the error has now gone so you  
48.24 -> would have missed an ending bracket or you could  have even added some additional brackets somewhere  
53.64 -> or you could have even misplaced a bracket for  your for Loop or any function or class so you need  
59.28 -> to just check for a bracket improper placement  of bracket so if you are using visual studio code  
64.56 -> I think one of the simplest way to solve this  problem is like if you just hover over the line  
69.48 -> number you'll be having this small down arrow  icon so if you just click it so we will be able  
75.18 -> to like see the span of our particular function  or a loop so this basically corresponds to the  
80.94 -> brackets opening point and closing point so if I  just now expand it you can see so if a for loop  
86.76 -> I can if I just now click it so this basically  tells us what is the span of this opening and  
91.56 -> closing bracket so if you just make use of this  feature it will be like helpful in solving your  
96.3 -> error so now I have just placed this bracket and  if I just now recompile it again yeah this time  
104.04 -> I won't be getting any errors and if I just now  run it again I'll be getting the output and I hope  
108.9 -> you would have found this video useful I've also  done many other tutorials in Java C C plus plus  
113.58 -> python node.js mongodb so do check other videos  of my channel subscribe me thanks for watching

Source: https://www.youtube.com/watch?v=HBSjf_HfvAw