The escape sequence in java are widely applicable in various domains and problems some of the applications are mentioned below: In the above example we have printed the backslash using the escape character. We can use control sequences to solve the above problem they are nothing but backslash with a character. So we use escape sequence in java to avoid these types of cases and situations. A similar type of problem may occur in cases of backslashes and double quotation marks. To prevent from this we should provide proper instructions to the compiler about the quotation mark. The code generates a compile-time error because the quotation mark instructs the computer to create a string even though the compiler was already engaged in another task. When the compiler arrives at this point, it becomes perplexed. In this instance, the phrase "Prepbytes"’ quotation marks are nested. ![]() This occurred because the compiler, which normally only anticipates strings inside of quotation marks, discovered a quotation mark before anticipating the closing quotation mark, which is where the string of text was supposed to be created. ("Hi Coders, welcome to " Prepbytes ".") What is the need to use Escape Sequence in Java?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |