Skip to content

Commit c902436

Browse files
committed
FIrst Quiz Push
1 parent c1ddff7 commit c902436

3 files changed

Lines changed: 364 additions & 11 deletions

File tree

Programming/tutorals/Java/JavaTutorials3.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,12 @@ <h1> Final Variables</h1>
129129
<p>If you don't want others (or yourself) to overwrite existing values, use the final keyword (this will declare the variable as "final" or "constant", which means unchangeable and read-only):</p>
130130
<script src="//onlinegdb.com/embed/js/V-L7yUOK5?theme=light"></script>
131131

132-
</script>
133132

134-
<h1 id="setup">The Main method</h1>
135-
<p>The main method is the entry point of a Java application, where the program starts execution. It must be defined as <code>public static void main(String[] args)</code>. and is required in every java program</p>
136-
<p>any code placed incside of a main() method will be excuted/ran</p>
137-
<p>For now, you don't need to understand the keywords public, static, and void. You will learn about them later in this tutorial. Just remember: main() is the starting point of every Java program.<p>
138-
<br>
139-
<h3 id="concept1">System.out.println()</h3>
140-
<p>Inside the main() method, we can use the println() method to print a line of text to the screen:</p>
141133

142-
<script src="//onlinegdb.com/embed/js/1mYbp6kgD?theme=light"></script>
143-
144134
<!-- Navigation Buttons at the Bottom -->
145135
<div style="display:flex; justify-content:space-between; margin-top:40px;">
146136
<button class="w3-button w3-blue" onclick="window.location.href='/'">Previous Lesson</button>
147-
<button class="w3-button w3-red" onclick="window.location.href='/Programming/tutorals/Java/JavaTutorials3.html'">Next Lesson</button>
137+
<button class="w3-button w3-red" onclick="window.location.href='/Programming/tutorals/Java/JavaTutorials4.html'">Next Lesson</button>
148138
</div>
149139

150140
</div>
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Tutorial Page Template</title>
7+
<link rel="stylesheet" href="https://www.w3schools.com/w3css/5/w3.css">
8+
<style>
9+
/* Sidebar styling */
10+
.sidebar {
11+
height: 100vh;
12+
overflow-y: auto;
13+
position: fixed;
14+
width: 180px;
15+
background-color: #003366;
16+
color: white;
17+
}
18+
.sidebar h3 {
19+
margin-top: 15px;
20+
margin-bottom: 5px;
21+
padding-left: 12px;
22+
color: #ff3333;
23+
font-size: 14px;
24+
}
25+
.sidebar a {
26+
display: block;
27+
padding: 6px 12px;
28+
text-decoration: none;
29+
color: white;
30+
font-size: 13px;
31+
border-radius: 4px;
32+
}
33+
.sidebar a:hover {
34+
background-color: #ff3333;
35+
color: white;
36+
}
37+
38+
/* Main content area */
39+
.main-content {
40+
margin-left: 190px;
41+
padding: 20px;
42+
background-color: white;
43+
color: #000;
44+
transition: background-color 0.3s, color 0.3s;
45+
}
46+
47+
/* Dark mode class */
48+
.darkmode {
49+
background-color: #1e1e1e;
50+
color: #f1f1f1;
51+
}
52+
.darkmode h1,
53+
.darkmode h3 {
54+
color: #ff6666;
55+
}
56+
57+
/* Button */
58+
.darkmode-btn {
59+
background-color: #ff3333;
60+
color: white;
61+
border: none;
62+
padding: 6px 12px;
63+
border-radius: 4px;
64+
cursor: pointer;
65+
margin-bottom: 15px;
66+
font-size: 14px;
67+
}
68+
.darkmode-btn:hover {
69+
background-color: #cc0000;
70+
}
71+
72+
h1 { color: #003366; }
73+
74+
</style>
75+
</head>
76+
<body>
77+
78+
<!-- Sidebar / Navigation -->
79+
<div class="sidebar w3-card">
80+
<h2 class="w3-center w3-padding-12" style="font-size:16px; color:white;">Tutorial Menu</h2>
81+
<h3>Java Syntax</h3>
82+
<a href="#intro">Introduction</a>
83+
<a href="#setup">Setup</a>
84+
<h3>Core Concepts</h3>
85+
<a href="#concept1">Concept 1</a>
86+
<a href="#concept2">Concept 2</a>
87+
<h3>Advanced</h3>
88+
<a href="#advanced1">Advanced 1</a>
89+
<a href="#advanced2">Advanced 2</a>
90+
</div>
91+
92+
<!-- Main Content Area -->
93+
<div class="main-content" id="mainContent">
94+
<button class="darkmode-btn" onclick="toggleDarkMode()">Toggle Dark Mode</button>
95+
96+
<h1 id="intro">Java Data types</h1>
97+
<p>As explained in the previous chapter, a variable in Java must be a specified data type:</p>
98+
<p>In Java there are different types of variables. Each type has a specific purpose and behavior.</p>
99+
<script src="//onlinegdb.com/embed/js/lGbi9p256?theme=light"></script>
100+
101+
<h3>Primitive Data Types</h3>
102+
<P>Data types are divided into two groups:<P>
103+
<ul>
104+
<li>Primitive Data Types: - includes byte, short, int, long, float, double, boolean and char</li>
105+
<li>Non-Primitive Data Types: - includes strings, classes, interfaces, and arrays</li>
106+
</ul>
107+
108+
<table>
109+
<tr>
110+
<th>Data Type</th>
111+
<th>Description</th>
112+
<th>Max value</th>
113+
<th>Min value</th>
114+
<th>Example</th>
115+
</tr>
116+
<tr>
117+
<td>byte</td>
118+
<td>8-bit signed integer</td>
119+
<td><code>127</code></td>
120+
<td><code>-128</code></td>
121+
<td><code>byte b = 100;</code></td>
122+
</tr>
123+
<tr>
124+
<td>short</td>
125+
<td>16-bit signed integer</td>
126+
<td><code>32767</code></td>
127+
<td><code>-32768</code></td>
128+
<td><code>short s = 10000;</code></td>
129+
</tr>
130+
<tr>
131+
<td>int</td>
132+
<td>32-bit signed integer</td>
133+
<td><code>2147483647</code></td>
134+
<td><code>-2147483648</code></td>
135+
<td><code>int i = 100000;</code></td>
136+
</tr>
137+
<tr>
138+
<td>long</td>
139+
<td>64-bit signed integer</td>
140+
<td><code>9223372036854775807L</code></td>
141+
<td><code>-9223372036854775808L</code></td>
142+
<td><code>long l = 100000L;</code></td>
143+
</tr>
144+
<tr>
145+
<td>float</td>
146+
<td>32-bit floating point (IEEE 754)</td>
147+
<td><code>≈ 3.4028235e38</code></td>
148+
<td><code>≈ -3.4028235e38</code></td>
149+
<td><code>float f = 3.14f;</code></td>
150+
</tr>
151+
<tr>
152+
<td>double</td>
153+
<td>64-bit floating point (IEEE 754)</td>
154+
<td><code>≈ 1.7976931348623157e308</code></td>
155+
<td><code>≈ -1.7976931348623157e308</code></td>
156+
<td><code>double d = 3.14159;</code></td>
157+
</tr>
158+
<tr>
159+
<td>boolean</td>
160+
<td>Logical type with two values</td>
161+
<td colspan="2"><code>true or false</code></td>
162+
<td><code>boolean flag = true;</code></td>
163+
</tr>
164+
<tr>
165+
<td>char</td>
166+
<td>16-bit Unicode character</td>
167+
<td><code>'\uffff' (65535)</code></td>
168+
<td><code>'\u0000' (0)</code></td>
169+
<td><code>char c = 'A';</code></td>
170+
</tr>
171+
</table>
172+
173+
<h3> You cannot change Data types</h3>
174+
<p>In Java, once a variable is declared with a specific data type, it cannot be
175+
<script src="//onlinegdb.com/embed/js/FPEuJueWA?theme=light"></script>
176+
177+
178+
<!-- Navigation Buttons at the Bottom -->
179+
<div style="display:flex; justify-content:space-between; margin-top:40px;">
180+
<button class="w3-button w3-red" onclick="window.location.href='/Programming/tutorals/Java/JavaTutorials3.html'">Previous Lesson</button>
181+
<button class="w3-button w3-red" onclick="window.location.href='/Programming/tutorals/Java/JavaTutorials5.html'">Next Lesson</button>
182+
</div>
183+
184+
</div>
185+
186+
<script>
187+
const content = document.getElementById('mainContent');
188+
189+
// Apply saved preference or system preference on load
190+
function applyPreference() {
191+
const saved = localStorage.getItem('darkmode');
192+
if (saved === 'true') {
193+
content.classList.add('darkmode');
194+
} else if (saved === 'false') {
195+
content.classList.remove('darkmode');
196+
} else {
197+
// Follow system preference if no saved value
198+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
199+
content.classList.add('darkmode');
200+
}
201+
}
202+
}
203+
204+
window.onload = applyPreference;
205+
206+
// Toggle dark/light mode and save preference
207+
function toggleDarkMode() {
208+
if (content.classList.contains('darkmode')) {
209+
content.classList.remove('darkmode');
210+
localStorage.setItem('darkmode', 'false');
211+
} else {
212+
content.classList.add('darkmode');
213+
localStorage.setItem('darkmode', 'true');
214+
}
215+
}
216+
</script>
217+
218+
</body>
219+
</html>
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<!DOCTYPE html>
2+
<html lang="en-US">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Tutorial Page Template</title>
7+
<link rel="stylesheet" href="https://www.w3schools.com/w3css/5/w3.css">
8+
<style>
9+
/* Sidebar styling */
10+
.sidebar {
11+
height: 100vh;
12+
overflow-y: auto;
13+
position: fixed;
14+
width: 180px;
15+
background-color: #003366;
16+
color: white;
17+
}
18+
.sidebar h3 {
19+
margin-top: 15px;
20+
margin-bottom: 5px;
21+
padding-left: 12px;
22+
color: #ff3333;
23+
font-size: 14px;
24+
}
25+
.sidebar a {
26+
display: block;
27+
padding: 6px 12px;
28+
text-decoration: none;
29+
color: white;
30+
font-size: 13px;
31+
border-radius: 4px;
32+
}
33+
.sidebar a:hover {
34+
background-color: #ff3333;
35+
color: white;
36+
}
37+
38+
/* Main content area */
39+
.main-content {
40+
margin-left: 190px;
41+
padding: 20px;
42+
background-color: white;
43+
color: #000;
44+
transition: background-color 0.3s, color 0.3s;
45+
}
46+
47+
/* Dark mode class */
48+
.darkmode {
49+
background-color: #1e1e1e;
50+
color: #f1f1f1;
51+
}
52+
.darkmode h1,
53+
.darkmode h3 {
54+
color: #ff6666;
55+
}
56+
57+
/* Button */
58+
.darkmode-btn {
59+
background-color: #ff3333;
60+
color: white;
61+
border: none;
62+
padding: 6px 12px;
63+
border-radius: 4px;
64+
cursor: pointer;
65+
margin-bottom: 15px;
66+
font-size: 14px;
67+
}
68+
.darkmode-btn:hover {
69+
background-color: #cc0000;
70+
}
71+
72+
h1 { color: #003366; }
73+
74+
</style>
75+
</head>
76+
<body>
77+
78+
<!-- Sidebar / Navigation -->
79+
<div class="sidebar w3-card">
80+
<h2 class="w3-center w3-padding-12" style="font-size:16px; color:white;">Tutorial Menu</h2>
81+
<h3>Java Syntax</h3>
82+
<a href="#intro">Introduction</a>
83+
<a href="#setup">Setup</a>
84+
<h3>Core Concepts</h3>
85+
<a href="#concept1">Concept 1</a>
86+
<a href="#concept2">Concept 2</a>
87+
<h3>Advanced</h3>
88+
<a href="#advanced1">Advanced 1</a>
89+
<a href="#advanced2">Advanced 2</a>
90+
</div>
91+
92+
<!-- Main Content Area -->
93+
<div class="main-content" id="mainContent">
94+
<button class="darkmode-btn" onclick="toggleDarkMode()">Toggle Dark Mode</button>
95+
96+
<h1 id="intro">Java Basics Quiz</h1>
97+
<p>For this quiz, please write a program that will print a String, Integer, and Double on separate lines, these variables can go in any order and may include whatever you want, they just have to be of the given type. Also include comments on what type each variable is.</p>
98+
<p>press forkme to head over to onlinegdb to headonver to an Online Java editor</press>
99+
<script src="//onlinegdb.com/embed/js/MeotQlh6K?theme=light"></script>
100+
<br>
101+
<br>
102+
103+
<!-- Navigation Buttons at the Bottom -->
104+
<div style="display:flex; justify-content:space-between; margin-top:40px;">
105+
<button class="w3-button w3-red" onclick="window.location.href='/Programming/tutorals/Java/JavaTutorials3.html'">Previous Lesson</button>
106+
<button class="w3-button w3-red" onclick="window.location.href='/Programming/tutorals/Java/JavaTutorials5.html'">Next Lesson</button>
107+
</div>
108+
109+
</div>
110+
111+
<script>
112+
const content = document.getElementById('mainContent');
113+
114+
// Apply saved preference or system preference on load
115+
function applyPreference() {
116+
const saved = localStorage.getItem('darkmode');
117+
if (saved === 'true') {
118+
content.classList.add('darkmode');
119+
} else if (saved === 'false') {
120+
content.classList.remove('darkmode');
121+
} else {
122+
// Follow system preference if no saved value
123+
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
124+
content.classList.add('darkmode');
125+
}
126+
}
127+
}
128+
129+
window.onload = applyPreference;
130+
131+
// Toggle dark/light mode and save preference
132+
function toggleDarkMode() {
133+
if (content.classList.contains('darkmode')) {
134+
content.classList.remove('darkmode');
135+
localStorage.setItem('darkmode', 'false');
136+
} else {
137+
content.classList.add('darkmode');
138+
localStorage.setItem('darkmode', 'true');
139+
}
140+
}
141+
</script>
142+
143+
</body>
144+
</html>

0 commit comments

Comments
 (0)