ASDV-Java/Semester 2/Assignments/lab7_CalebFontenot/Printed HTMLs/OOM.html

51 lines
2.5 KiB
HTML

2023-04-14 01:01:58 +07:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>OOM.java</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
<!--
body {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
pre {color: #a9b7c6; background-color: #2b2b2b; font-family: monospace; font-weight: bold}
table {color: #888888; background-color: #313335; font-family: monospace; font-weight: bold}
.literal {color: #cc7832}
.number {color: #6897bb}
.string {color: #6a8759}
.comment {color: #808080}
.whitespace {color: #505050}
-->
</style>
</head>
<body>
<table width="100%"><tr><td align="center">/home/caleb/ASDV-Java/Semester 2/Assignments/lab7_CalebFontenot/src/main/java/com/calebfontenot/lab7_calebfontenot/OOM.java</td></tr></table>
<pre>
<span class="comment">/*</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license</span>
<span class="comment"> * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template</span>
<span class="comment"> */</span>
<span class="literal">package</span> com.calebfontenot.lab7_calebfontenot;
<span class="comment">/**</span>
<span class="comment"> *</span>
<span class="comment"> * </span><span class="comment">@author</span> <span class="comment">caleb</span>
<span class="comment">*/</span>
<span class="literal">public</span> <span class="literal">class</span> OOM {
<span class="literal">public</span> <span class="literal">static</span> <span class="literal">void</span> main(String[] args)
{
<span class="literal">try</span> {
Integer[][] oomArray = <span class="literal">new</span> Integer[<span class="number">20000</span>][<span class="number">20000</span>];
<span class="literal">for</span> (<span class="literal">int</span> i = <span class="number">0</span>; i &lt; oomArray.length; ++i ) {
<span class="literal">for</span> (<span class="literal">int</span> j = <span class="number">0</span>; j &lt; oomArray.length; ++j ) {
oomArray[i][j] = i * j;
<span class="comment">//System.out.println(oomArray[i][j]);</span>
}
}
} <span class="literal">catch</span> (OutOfMemoryError ex) {
System.out.println(<span class="string">&quot;</span><span class="string">Out of memory! </span><span class="string">&quot;</span> + ex);
}
}
}
</pre></body>
</html>