如何在javascript中在控制台中打印多行?

时间:2016-12-04 05:27:12

标签: java console

我试图在控制台中打印多行(如下所示),买我无法打印出来。

<!DOCTYPE html>
<html lang="en-US">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<body>

<div ng-app="">

    <p>Name : <input type="text" ng-model="name"></p>
    <h1>Hello '{{name}}'</h1>enter code here

</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

我解决了它

public class MultipleStringPrint {
public static void main(String[] args) {

    String str = "<!DOCTYPE html> \n <html lang=\"en-US\"> \n "
            + "\"<script src=\"http:\\/\\/ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js\"><\\/script> \n    "
            + "<body> \n <div ng-app=\"\">\n "
            + "<p>Name : <input type=\"text\" ng-model=\"name\"></p>\n \t "
            + "<h1>Hello '{{name}}'</h1>\n "
            + "\t <\\/div>\n    "
            + "<\\/body>\n  "
            + "<\\/html>\n";

    System.out.println(str);
}
|