Need help with -
“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.”
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles.css" />
<title>Java Documentation Page</title>
</head>
<body>
<nav id="navbar">
<header>Java Programming</header>
<ul>
<li>
<a class="nav-link" href="#Install_Java_Development_Kit_JDK">Install Java Development Kit (JDK)</a>
</li>
<li>
<a class="nav-link" href="#Set_Up_Integrated_Development_Environment_IDE">Set Up Integrated Development Environment (IDE)</a>
</li>
<li>
<a class="nav-link" href="#Write_Your_First_Java_Program">Write Your First Java Program</a>
</li>
<li>
<a class="nav-link" href="#Compile_and_Run_Your_Program">Compile and Run Your Program</a>
</li>
<li>
<a class="nav-link" href="#Learn_Java_Fundamentals_and_Practice">Learn Java Fundamentals and Practice</a>
</li>
</ul>
</nav>
<main id="main-doc">
<section class="main-section" id="Install_Java_Development_Kit_JDK">
<header>Install Java Development Kit (JDK)</header>
<p>DK includes the Java Runtime Environment (JRE), necessary for running Java applications, and the Java Development Kit (JDK), which includes tools for developing Java programs.</p>
<p>Visit the official Oracle website or AdoptOpenJDK to download and install the JDK appropriate for your operating system. After installation, set up the JAVA_HOME environment variable to point to the JDK installation directory.</p>
<li>JDK Installation: Download and install the JDK from either the official Oracle website or AdoptOpenJDK.</li>
<li>Components Included: The JDK comprises both the Java Runtime Environment (JRE) for executing Java applications and the Java Development Kit (JDK) with tools for Java development.</li>
<li>Operating System Compatibility: Ensure to choose the appropriate JDK version compatible with your operating system.</li>
<li>etting up JAVA_HOME: After installation, configure the JAVA_HOME environment variable to indicate the JDK installation directory.</li>
<li>Directory Configuration: Verify that the JDK installation directory is properly set in the system's PATH variable for seamless usage of Java tools and commands.</li>
</section>
<section class="main-section" id="Set_Up_Integrated_Development_Environment_IDE">
<header>Set Up Integrated Development Environment (IDE)</header>
<p>An IDE provides a comprehensive environment for writing, compiling, and debugging Java code efficiently.</p>
<p>Popular IDEs for Java development include IntelliJ IDEA, Eclipse, and NetBeans. Download and install your preferred IDE. Then, create a new Java project within the IDE.</p>
</section>
<section class="main-section" id="Write_Your_First_Java_Program">
<header>Write Your First Java Program.</header>
<p>Start with a simple "Hello, World!" program to ensure your setup is correct and to get familiar with basic Java syntax.</p>
<p>Example:</p>
<pre>
<code>
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
</code>
</pre>
<p>Alt. Example:</p>
<pre>
<code>
public class SumOfTwoNumbers {
public static void main(String[] args) {
int num1 = 5;
int num2 = 7;
int sum = num1 + num2;
System.out.println("The sum of " + num1 + " and " + num2 + " is: " + sum);
}
}
</code>
</pre>
<li>This Java program calculates the sum of two numbers (num1 and num2) and prints the result.</li>
<li>Inside the main method, two integers (num1 and num2) are declared and initialized with values 5 and 7 respectively.</li>
<li>The sum of num1 and num2 is calculated and stored in the variable sum.</li>
<li>Finally, the System.out.println() statement prints the sum along with a descriptive message to the console.</li>
</section>
<section class="main-section" id="Compile_and_Run_Your_Program">
<header>Compile and Run Your Program</header>
<p>After writing the program, compile it into bytecode using the Java compiler (javac) and then execute it using the Java Virtual Machine (JVM).</p>
<p>Open your IDE's terminal or command prompt, navigate to the directory containing your Java file, and run the following commands:</p>
<pre>
<code>
javac HelloWorld.java // Compile the Java file
java HelloWorld // Execute the compiled bytecode
</code>
</pre>
<p>Alt. Example(Input from User and Output):</p>
<pre>
<code>
import java.util.Scanner;
public class InputOutputExample {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = scanner.nextLine();
System.out.print("Enter your age: ");
int age = scanner.nextInt();
System.out.println("Hello, " + name + "! You are " + age + " years old.");
scanner.close();
}
}
</code>
</pre>
<li>This program takes input from the user for their name and age.</li>
<li>It utilizes the Scanner class to read input from the console.</li>
<li>The entered name and age are then used to display a personalized greeting.</li>
<p>Alt. Example (Using Arrays):</p>
<pre>
<code>
public class ArrayExample {
public static void main(String[] args) {
int[] numbers = {10, 20, 30, 40, 50};
System.out.println("Numbers in the array:");
for (int number : numbers) {
System.out.print(number + " ");
}
System.out.println();
int sum = 0;
for (int number : numbers) {
sum += number;
}
System.out.println("Sum of the numbers: " + sum);
}
}
</code>
</pre>
<li>This program demonstrates the use of arrays in Java.</li>
<li>An array named numbers is initialized with some integer values.</li>
<li>It then prints the numbers in the array and calculates their sum using a for loop.</li>
<p>You can compile and run these programs similarly using the Java compiler (javac) and the Java Virtual Machine (java).</p>
</section>
<section class="main-section" id="Learn_Java_Fundamentals_and_Practice">
<header>Learn Java Fundamentals and Practice</header>
<p>Dive deeper into Java by learning its fundamentals, including data types, control flow, object-oriented programming concepts, and standard libraries. Practice writing programs to reinforce your understanding.</p>
<p>Explore online tutorials, Java documentation, and books. Join programming communities or forums to seek help and collaborate with others.
</p>
<p>By following these steps and continuously practicing, you'll gradually become proficient in Java programming.</p>
</section>
<footer>DRACT</footer>
</main>
</body>
</html>
Much appreciated!