我编写此代码只是为了显示写在'pre'标记内的内容,并将其另存为abc.html
<pre>
public class ReverseArr {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of array : ");
int n = scanner.nextInt();
//Declaring the array
int arr[] = new int[n];
System.out.println("Enter the array elements : ");
for(int i=0;i<n;i++) {
arr[i] = scanner.nextInt();
}
System.out.println("The Entered elements are : ");
for(int i=0;i<n;i++) {
System.out.print(arr[i] + " ");
}
System.out.println();
System.out.println("The reverse of array is : ");
for(int i=n-1;i>=0;i--) {
System.out.print(arr[i] + " ");
}
}
}
</pre>
我在chrome和firefox中运行它,但输出为:
public class ReverseArr {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of array : ");
int n = scanner.nextInt();
//Declaring the array
int arr[] = new int[n];
System.out.println("Enter the array elements : ");/*After that problem occurs*/
for(int i=0;i=0;i--) {
System.out.print(arr[i] + " ");
}
}
}
为什么完整的内容没有显示在浏览器(Chrome,Firefox)中?需要进行哪些更改才能显示在浏览器的'pre'标签内编写的完整内容?
如评论中所指出,问题是代码中的尖括号(<
和>
)弄乱了HTML布局。