如何在Java中使用String Literal

时间:2014-05-29 08:00:07

标签: java c# string-literals

string s = @"This is the first line.
             and this is the second line without escapes
             and another one joins the fuss";

我们在C#中执行此操作,使用 @ 将文字文本分配给没有任何转义字符的字符串。

现在我必须在Java&我是Java的新手。谁能告诉我如何在Java中做同样的事情。

p.s我知道这是一个不好的问题,但请耐心等待......从下面你会知道为什么这对我来说非常重要

INSERT INTO `timetable` (`ID`, `teacherID`, `courseID`, `dayOfWeek`, `startTime`, `endTime`, `Block`, `RoomNo`, `isSynchronized`) VALUES
(1, 1, 'CS105', 1, '08:00:00', '09:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(2, 1, 'CS105', 1, '09:00:00', '10:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(3, 1, 'CS105', 1, '10:00:00', '11:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(4, 1, 'CS105', 1, '11:00:00', '12:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(5, 1, 'CS105', 1, '12:00:00', '13:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(6, 1, 'CS105', 1, '13:00:00', '14:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(7, 1, 'CS105', 1, '14:00:00', '15:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(8, 1, 'CS105', 1, '15:00:00', '16:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(9, 1, 'CS105', 1, '16:00:00', '17:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(10, 1, 'CS105', 2, '08:00:00', '09:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(11, 1, 'CS105', 2, '09:00:00', '10:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(12, 1, 'CS105', 2, '10:00:00', '11:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(13, 1, 'CS105', 2, '11:00:00', '12:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(14, 1, 'CS105', 2, '12:00:00', '13:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(15, 1, 'CS105', 2, '13:00:00', '14:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(16, 1, 'CS105', 2, '14:00:00', '15:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(17, 1, 'CS105', 2, '15:00:00', '16:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(18, 1, 'CS105', 2, '16:00:00', '17:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(19, 1, 'CS105', 3, '08:00:00', '09:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(20, 1, 'CS105', 3, '09:00:00', '10:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(21, 1, 'CS105', 3, '10:00:00', '11:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(22, 1, 'CS105', 3, '11:00:00', '12:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(23, 1, 'CS105', 3, '12:00:00', '13:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(24, 1, 'CS105', 3, '13:00:00', '14:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(25, 1, 'CS105', 3, '14:00:00', '15:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(26, 1, 'CS105', 3, '15:00:00', '16:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(27, 1, 'CS105', 3, '16:00:00', '17:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(28, 1, 'CS105', 4, '08:00:00', '09:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(29, 1, 'CS105', 4, '09:00:00', '10:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(30, 1, 'CS105', 4, '10:00:00', '11:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(31, 1, 'CS105', 4, '11:00:00', '12:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(32, 1, 'CS105', 4, '12:00:00', '13:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(33, 1, 'CS105', 4, '13:00:00', '14:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(34, 1, 'CS105', 4, '14:00:00', '15:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(35, 1, 'CS105', 4, '15:00:00', '16:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(36, 1, 'CS105', 4, '16:00:00', '17:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(37, 1, 'CS105', 5, '08:00:00', '09:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(38, 1, 'CS105', 5, '09:00:00', '10:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(39, 1, 'CS105', 5, '10:00:00', '11:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(40, 1, 'CS105', 5, '11:00:00', '12:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(41, 1, 'CS105', 5, '12:00:00', '13:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(42, 1, 'CS105', 5, '13:00:00', '14:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(43, 1, 'CS105', 5, '14:00:00', '15:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(44, 1, 'CS105', 5, '15:00:00', '16:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(45, 1, 'CS105', 5, '16:00:00', '17:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(46, 1, 'CS105', 6, '08:00:00', '09:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(47, 1, 'CS105', 6, '09:00:00', '10:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(48, 1, 'CS105', 6, '10:00:00', '11:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(49, 1, 'CS105', 6, '11:00:00', '12:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(50, 1, 'CS105', 6, '12:00:00', '13:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(51, 1, 'CS105', 6, '13:00:00', '14:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(52, 1, 'CS105', 6, '14:00:00', '15:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(53, 1, 'CS105', 6, '15:00:00', '16:00:00', 'Allama Iqbal Block', 'LH-786', 0),
(54, 1, 'CS105', 6, '16:00:00', '17:00:00', 'Allama Iqbal Block', 'LH-786', 0);

并且还有更多这些我不能整天把它们转换成单行。

1 个答案:

答案 0 :(得分:0)

Java中没有字符串文字。