Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

backspace character problem

  Asked By: Hondo    Date: Dec 30    Category: Java    Views: 1642
  


i am here with a new query

i used the \b - backspace character statement in my java code and found that it
did not perform as expected

class Temp

{

public static void main(String[] args)

{

System.out.println("Temp\b");

}

}

------------------

i expected the backspace character to delete the last letter in Temp and the
expected result was " meghn "

but the result mister java gave me was "Temp"



i tried again with the backspace character in a different posistion



class Temp

{

public static void main(String[] args)

{

System.out.println("Te\bmp");

}

}


and the result was "Tebmp" which was the expected result.


now why does java not delete the last character when backspace is used in the
end ????

thanks a lot for continued support

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Bonnie Hughes     Answered On: Dec 30

Because \b only moves the cursor back one spot in the buffer. It does
not overwrite what is already there.

 
Didn't find what you were looking for? Find more on backspace character problem Or get search suggestion and latest updates.




Tagged: