Break and continue

if we have to use break and continue , we need to use while(true)??

no
not necessarily
when u do not want to specify the breaking condiiton at the start inside while loop u can use true

read more here


and inside the while loop specify thebreaking condition