Tell us what’s happening:
Your code so far
My code refuses to pass it shows two errors:
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.
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”).
<body>
<nav id="navbar">
<header>Java Documentation</header>
<ul>
<li>
<a class="nav-link" href="#Getting_started_with_Java">Getting started with Java</a>
</li>
<li>
<a class="nav-link" href="#Java_Entry_Point">Java Entry Point</a>
</li>
<li>
<a class="nav-link" href="#Printing_to_the_console">Printing to the console</a>
</li>
<li>
<a class="nav-link" href="#Declaring_Function">Declaring Function</a>
</li>
<li>
<a class="nav-link" href="#Object_Oriented_Programming">Object Oriented Programming</a>
</li>
</ul>
Getting started with Java
Steps in getting started
- Download Java
- Download Java SDK
- Get an Integrated Development Environment (IDE)
- Start a project within the IDE
- Code up "Hello World" and run the code
-
Java Entry Point
The entry point to a java application is the main function.
It is categorized by its (String[] arg) as a parameter to the function
public class MyMainFunction {
/* Java main function example */
public static void main(String[] args) {
}
}
</code>
</pre>
<p>
As you can see the main function is wrapped within a class which is part of the object oriented structure of Java Projects.
part of the object oriented structure of Java Projects.
</p>
<p>The name of the project is therefore "MyMainFunction"
</section>
<section id="Printing_to_the_console" class="main-section" >
<header>Printing to the console</header>
<p>In order to print to the console. We use System.out.printin.</p>
<p>
I know, it is very long and cumbersome, but this is the way it's done.
</p>
<pre>
<code>
public class MyMainFunction {
/* Java main function example */
public static void main(String[] args) { System.out.printin("Hello World")
}
}
</code>
</pre>
<p>
In this example we are printing out "Hello World" to the console when we run the program.
</p>
</section>
<section id="Declaring_Function" class="main-section" >
<header>Declaring Functions</header>
<p>
Functions are actually called methods in Java. Here is an example of how to declare a Java method.
</p>
<img src="https://simplesnippets.tech/wp-content/uploads/2018/03/methods-in-java-programming.jpg" alt="java-method-img" class="image" />
<p>Some copiable code:</p>
<pre>
<code>
Public static void myFunction(String name, int age)
{
//function code
}
</code>
</pre>
</section>
<section id="Object_Oriented_Programming" class="main-section" >
<header>Object Oriented Programming</header>
<p>Java is known as an object oriented programming language.</p>
<p>
This means that it is easy to represent entities as objects by using classes and encapsulation.
</p>
<p>
An example of this night be a Student class to represent a student
</p>
<pre>
<code>
public class Student {
/* Student properties */
private String name;
private int age;
/* Constructor */
public Student(String name, int age){
this.name = name;
this.age = age;
}
/* Getter method */
public String getName() {
return name;
}
/* Setter method */
public void setName(String name) {
this.name = name;
}
}
</code>
</pre>
<p>We use this class by doing the following:</p>
<pre>
<code>
Student student1 = new Student("Jimmy", 19);
String jimmyName = student1.getName();
student1.setName("Kevin");
String kevinName = student1.getName();
</code>
Documentation brought to you on the fly by Kewonte' Thomas
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Challenge Information:
Technical Documentation Page - Build a Technical Documentation Page