Samsung Interview Question
Software Engineer / DevelopersCountry: India
Interview Type: In-Person
<pre lang="" line="1" title="CodeMonkey76495" class="run-this">/* The class name doesn't have to be Main, as long as the class is not public. */
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
String s;
while (!(s=r.readLine()).startsWith("42")) System.out.println(s);
}
}
</pre><pre title="CodeMonkey76495" input="yes">55
</pre>
So what essentially you are expected to do is to create a DOM parser which can be modified in memory and re-written to the same file.
- KM November 01, 2011