Tell us what’s happening:
hi , I can not understand why these two tests are not valid yet any help ? this is my code so far : Each .main-section should have an id that matches the text of its first child, having any spaces in the child’s text replaced with underscores (_) for the id’s. and Each .nav-link should have text that corresponds to the header text of its related section (e.g. if you have a “Hello world” section/header, your #navbar should have a .nav-link which has the text “Hello world”).
Your code so far
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Java</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<nav id="navbar">
<header>Java Basics</header>
<ul>
<li>
<a class="nav-link" href="#Introduction">Introduction</a>
</li>
<li>
<a class="nav-link" href="#Essential_Java_Terminologies_You_Need_to_Know">Essential Java Terminologies You Need to Know</a>
</li>
<li>
<a class="nav-link" href="#Differences_between_JDK_JRE_and_JVM">Differences between JDK JRE and JVM</a>
</li>
<li>
<a class="nav-link" href="#Hello_world">Hello world</a>
</li>
<li>
<a class="nav-link" href="#Data_types">Data types</a>
</li>
<li>
<a class="nav-link" href="#Variables">Variables</a>
</li>
<li>
<a class="nav-link" href="#Operators">Operators</a>
</li>
<li>
<a class="nav-link" href="#If_statment">If statement</a>
</li>
<li>
<a class="nav-link" href="#Switch_statement">Switch statement</a>
</li>
<li>
<a class="nav-link" href="#Break_Continue_Return">Break Continue Return</a>
</li>
<li>
<a class="nav-link" href="#Loops">Loops</a>
</li>
<li>
<a class="nav-link" href="#Reference">Reference</a>
</li>
</ul>
</nav>
<main id="main-doc">
<section class="main-section" id="Introduction">
<header>Introduction</header>
<article>
<p>
Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is intended to let application developers Write Once and Run Anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation. Java was developed by James Gosling at Sun Microsystems Inc. in May 1995 and later acquired by Oracle Corporation and is widely used for developing applications for desktop, web, and mobile devices.
</p>
<p>
Java is known for its simplicity, robustness, and security features, making it a popular choice for enterprise-level applications. Java applications are compiled to byte code that can run on any Java Virtual Machine. The syntax of Java is similar to C/C++.
</p>
</article>
</section>
<section class="main-section" id="Essential_Java_Terminologies_You_Need_to_Know">
<header>Essential Java Terminologies You Need to Know</header>
<article>
<p>Before learning Java, one must be familiar with these common terms of Java.</p>
<ul>
<li> Java Virtual Machine(JVM)
<p>The JVM is an integral part of the Java platform, responsible for executing Java bytecode. It ensures that the output of Java programs is consistent across different platforms.</p>
<p>Writing a program is done by a java programmer like you and me.</p>
<p>The compilation is done by the JAVAC compiler which is a primary Java compiler included in the Java development kit (JDK). It takes the Java program as input and generates bytecode as output.</p>
<p>In the Running phase of a program, JVM executes the bytecode generated by the compiler.</p>
<p>The Java Virtual Machine (JVM) is designed to run the bytecode generated by the Java compiler. Each operating system has its own version of the JVM, but all JVMs follow the same rules and standards. This means Java programs can run the same way on any device with a JVM, regardless of the operating system. This is why Java is called a platform-independent language.</p>
</li>
<li>Bytecode
<p>Bytecode is the intermediate representation of Java code, generated by the Java compiler. It is platform-independent and can be executed by the JVM.</p>
</li>
<li>Java Development Kit(JDK)
<p>While we were using the term JDK when we learn about bytecode and JVM. So, as the name suggests, it is a complete Java development kit that includes everything including compiler, Java Runtime Environment (JRE), Java Debuggers, Java Docs, etc. For the program to execute in java, we need to install JDK on our computer in order to create, compile and run the java program.</p>
</li>
<li> Java Runtime Environment (JRE)
<p>JDK includes JRE. JRE installation on our computers allows the java program to run, however, we cannot compile it. JRE includes a browser, JVM, applet support, and plugins. For running the java program, a computer needs JRE.</p>
</li>
<li>Garbage Collector
<p>In Java, programmers can not delete the objects. To delete or recollect that memory JVM has a program called Garbage Collector. Garbage Collectors can recollect the objects that are not referenced. So Java makes the life of a programmer easy by handling memory management. However, programmers should be careful about their code whether they are using objects that have been used for a long time. Because Garbage cannot recover the memory of objects being referenced.</p>
</li>
<li>ClassPath
<p>The Classpath is the file path where the java runtime and Java compiler look for .class files to load. By default, JDK provides many libraries. If you want to include external libraries they should be added to the classpath.Basically everything in java is represented in Class as an object including the main function.</p>
</li>
</ul>
</article>
</section>
<section class="main-section" id="Differences_between_JDK_JRE_and_JVM">
<header>Differences between JDK JRE and JVM</header>
<article>
<p>The main difference between JDK, JRE, and JVM is:</p>
<ul>
<li>JDK: Java Development Kit is a software development environment used for developing Java applications and applets.</li>
<li>JRE: JRE stands for Java Runtime Environment and it provides an environment to run only the Java program onto the system.</li>
<li>JVM: JVM stands for Java Virtual Machine and is responsible for executing the Java program.</li>
</ul>
</article>
</section>
<section class="main-section" id="Hello_world">
<header>Hello world</header>
<article>
<code>// A Java program to print "Hello World"
public class GFG {
public static void main(String args[])
{
System.out.println("Hello World");
}
}
// Output:"Hello World"</code>
</article>
</section>
<section class="main-section" id="Data_types">
<header>Data types</header>
<article>
<p>Java is statically typed and also a strongly typed language because, in Java, each type of data (such as integer, character, hexadecimal, packed decimal, and so forth) is predefined as part of the programming language and all constants or variables defined for a given program must be described with one of the Java data types.</p>
<p>Data types in Java are of different sizes and values that can be stored in the variable that is made as per convenience and circumstances to cover up all test cases. Java has two categories in which data types are segregated</p>
<ol>
<li>Primitive Data Type: such as boolean, char, int, short, byte, long, float, and double. The Boolean with uppercase B is a wrapper class for the primitive data type boolean in Java.</li>
<li>Non-Primitive Data Type or Object Data type: such as String, Array, etc.</li></ol>
</article>
</section>
<section class="main-section" id="Variables">
<header>Variables</header>
<article>
<p>Variables are the containers for storing the data values or you can also call it a memory location name for the data. Every variable has a:</p>
<ul>
<li>Data Type The kind of data that it can hold. For example, int, string, float, char, etc.</li>
<li>Variable Name To identify the variable uniquely within the scope.</li>
<li>Value The data assigned to the variable.</li>
</ul>
<p>There are three types of variables in Java Local, Instance, and Static.</p>
</article>
<article>
<p>How to Declare Java Variables?</p>
<p>while declaring a variable, we need to take care of two things that are:</p>
<ol>
<li>datatype: In Java, a data type define the type of data that a variable can hold.</li>
<li>data_name: Name was given to the variable. </li>
</ol>
<p>In this way, a name can only be given to a memory location. It can be assigned values in two ways:</p>
<ul>
<li>Variable Initialization</li>
<li>Assigning value by taking input</li>
</ul>
</article>
<article>
<p>Types of Java Variables</p>
<p>Now let us discuss different types of variables which are listed as follows:</p>
<ol>
<li>Local Variables</li>
<li>Instance Variables</li>
<li>Static Variables</li>
</ol>
</article>
</section>
<section class="main-section" id="Operators">
<header>Operators</header>
<article>
<img src="https://media.geeksforgeeks.org/wp-content/uploads/20241213183254601283/Java-Operators-768.webp">
</article>
</section>
<section class="main-section" id="If_statment">
<header>If statement</header>
<article>
<p> a user can decide among multiple options.The if statements are executed from the top down. As soon as one of the conditions controlling the if is true, the statement associated with that ‘if’ is executed, and the rest of the ladder is bypassed. If none of the conditions is true, then the final else statement will be executed. There can be as many as ‘else if’ blocks associated with one ‘if’ block but only one ‘else’ block is allowed with one ‘if’ block.</p>
<code>if (condition1) {
// code to be executed if condition1 is true
} else if (condition2) {
// code to be executed if condition2 is true
} else {
// code to be executed if all conditions are false
}</code>
</article>
</section>
<section class="main-section" id="Switch_statement">
<header>Switch statement</header>
<article>
<p>The switch statement is a multi way branch statement. It provides an easy way to dispatch execution to different parts of code based on the value of the expression. </p>
<code>switch (expression) {
case value1:
// code to be executed if expression == value1
break;
case value2:
// code to be executed if expression == value2
break;
// more cases…
default:
// code to be executed if no cases match}</code>
</article>
</section>
<section class="main-section" id="Break_Continue_Return">
<header>Break Continue Return</header>
<article>
<p>Java supports three jump statements: break, continue and return. These three statements transfer control to another part of the program.
Break: In Java, a break is majorly used for:
Terminate a sequence in a switch statement (discussed above).
To exit a loop.
Used as a “civilized” form of goto.Continue: Sometimes it is useful to force an early iteration of a loop. That is, you might want to continue running the loop but stop processing the remainder of the code in its body for this particular iteration. This is, in effect, a goto just past the body of the loop, to the loops end. The continue statement performs such an action. </p>
<p>The return statement is used to explicitly return from a method. That is, it causes program control to transfer back to the caller of the method.</p>
</article>
</section>
<section class="main-section" id="Loops">
<header>Loops</header
><article>
<p>Looping in programming languages is a feature that facilitates the execution of a set of instructions/functions repeatedly while some condition evaluates to true. Java provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.</p>
<p>In Java, there are three types of Loops which are listed below:</p>
<ul>
<li>for loop</li>
<li>while loop</li>
<li>do-while loop</li>
</ul>
<ul>
<li>
<p>for loop :</p>
<p>The for loop is used when we know the number of iterations (we know how many times we want to repeat a task). The for statement consumes the initialization, condition, and increment/decrement in one line thereby providing a shorter, easy-to-debug structure of looping.</p>
<p>Syntax:</p>
<code>for (initialization; condition; increment/decrement) {
// code to be executed}
</code>
</li>
<li>
<p> while Loop</p>
<p>A while loop is used when we want to check the condition before running the code.</p>
<p>Syntax:</p>
<code>while (condition) {
// code to be executed
}</code>
</li>
<li>
<p>do-while Loop</p>
<p>The do-while loop in Java ensures that the code block executes at least once before the condition is checked.</p>
<p>Syntax:</p>
<code>do {
//code to be executed
} while (condition);</code>
</li>
</ul>
</article>
</section>
<section class="main-section" id="Reference">
<header>Reference</header>
<p>All the documentation in this page is taken from <a href="://www.geeksforgeeks" target="_blank">geeks for geeks</a></p>
</section>
</main>
</body>
</html>
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Challenge Information:
Technical Documentation Page - Build a Technical Documentation Page