Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Technical Docs </title>
</head>
<body>
<nav id="navbar">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <header>Java Documentation</header>
  <ul>
    <li><a class="nav-link" href="#Introduction">Introduction</a></li>  
    <li><a class="nav-link" href="#Hello_world">Hello world</a></li>
    <li><a class="nav-link" href="#Variables">Variables</a></li>
    <li>
      <a class="nav-link" href="#Declaring_variables">Declaring variables</a>
    </li>
    <li><a class="nav-link" href="#Variable_scope">Variable scope</a></li>
  
  <li><a class="nav-link" href="#History">History</a></li>
</ul>
</nav>
  
<main id="main-doc">  
  
<section class="main-section" id="Introduction">
  
  <header>Introduction</header>  
  
  <article>
  
  <p>
  Java is a programming language created by James Gosling from Sun Microsystems (Sun) in 1991. The target of Java is to write a program once and then run this program on multiple operating systems. The first publicly available version of Java (Java 1.0) was released in 1995. Sun Microsystems was acquired by the Oracle Corporation in 2010. Oracle has now the steermanship for Java. In 2006 Sun started to make Java available under the GNU General Public License (GPL). Oracle continues this project called OpenJDK.
    
Over time new enhanced versions of Java have been released. The current version of Java is Java 1.8 which is also known as Java 8.<br>

Java is defined by a specification and consists of a programming language, a compiler, core libraries and a runtime (Java virtual machine) The Java runtime allows software developers to write program code in other languages than the Java programming language which still runs on the Java virtual machine. The Java platform is usually associated with the Java virtual machine and the Java core libraries.    
</p>
<ul>
  <h3>The Java language was designed with the following properties:</h3>
<li>
  Platform independent: Java programs use the Java virtual machine as abstraction and do not access the operating system directly. This makes Java programs highly portable. A Java program (which is standard-compliant and follows certain rules) can run unmodified on all supported platforms, e.g., Windows or Linux.<br>
  </li> 
 
<li>  
  Interpreted and compiled language: Java source code is transferred into the bytecode format which does not depend on the target platform. These bytecode instructions will be interpreted by the Java Virtual machine (JVM). The JVM contains a so called Hotspot-Compiler which translates performance critical bytecode instructions into native code instructions.
</li>  

 <li>
   Automatic memory management: Java manages the memory allocation and de-allocation for creating new objects. The program does not have direct access to the memory. The so-called garbage collector automatically deletes objects to which no active pointer exists.
</li>   
</ul>  
</article>
</section>  
  
<section class="main-section" id="Hello_world">
  
  <header>Hello world</header>  
<article> 
  
A "Hello, World!" is a simple program that outputs Hello, World! on the screen. Since it's a very simple program, it's often used to introduce a new programming language to a newbie.

Let's explore how Java "Hello, World!" program works.
  
<code>
  
class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!"); 
    }
}  
  
</code> 
</article>
</section>  

<section class="main-section" id="Variables">
  
  <header>Variables</header>  
<article>   
 
<p>You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules.</p>  
  
  <p> A Java identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be digits (0-9). Because Java is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase).</p>  

  <p>You can use ISO 8859-1 or Unicode letters such as å and ü in identifiers. You can also use the Unicode escape sequences as characters in identifiers. Some examples of legal names are Number_hits, temp99, and _name.</p> 
 <ul>  
 <li>
  String - stores text, such as "Hello". String values are surrounded by double quotes
  
  </li>
  int - stores integers (whole numbers), without decimals, such as 123 or -123


  <li>
float - stores floating point numbers, with decimals, such as 19.99 or -19.99  
  
  </li>
  
  <li>
  
char - stores single characters, such as 'a' or 'B'. Char values are surrounded by single quotes  
  </li>
  
  <li>
  
boolean - stores values with two states: true or false  
  </li>
  </ul>  

Examples:
  
<code>
  int myNum = 15;
System.out.println(myNum);
  
  </code>
  
  <code>
  int myNum;
myNum = 15;
System.out.println(myNum);
</code>
  
  <code>
int myNum = 15;
myNum = 20;  // myNum is now 20
System.out.println(myNum);    
  </code>
  <code>
  String name = "John";
System.out.println(name);
   </code> 
    Other Types
  <code>
  int myNum = 5;
float myFloatNum = 5.99f;
char myLetter = 'D';
boolean myBool = true;
String myText = "Hello";  
  </code>  
 </article>  
</section>

<section class="main-section" id="Declaring_variables">
  
  <header>Declaring variables</header>  
<article>
  
To create a variable, you must specify the type and assign it a value:
  
  <h4> Synatax</h4>
 
  type variable = value;
  </article>  

 <section class="main-section" id="Variable_scope">
  
  <header>Variable scope</header>  
<article> 
  <p>
  When you declare a variable outside of any function, it is called a global variable, because it is available to any other code in the current document. When you declare a variable within a function, it is called a local variable, because it is available only within that function.<br>

JavaScript before ECMAScript 2015 does not have block statement scope; rather, a variable declared within a block is local to the function (or global scope) that the block resides within. For example the following code will log 5, because the scope of x is the function (or global context) within which x is declared, not the block, which in this case is an if statement.
  </p>
   </article>
  </section>

<section class="main-section" id="History">
  
  <header>History</header>  
  
  <article>
  
  <p>  
  James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991.[22] Java was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time.[23] The language was initially called Oak after an oak tree that stood outside Gosling's office. Later the project went by the name Green and was finally renamed Java, from Java coffee, a type of coffee from Indonesia.[24] Gosling designed Java with a C/C++-style syntax that system and application programmers would find familiar.[25]
 </p>
    
    <p>  
  
 Sun Microsystems released the first public implementation as Java 1.0 in 1996.[26] It promised Write Once, Run Anywhere (WORA) functionality, providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification.[27] With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively. 
  
    </p>
    <p>  
  
  On November 13, 2006, Sun released much of its Java virtual machine (JVM) as free and open-source software (FOSS), under the terms of the GNU General Public License (GPL). On May 8, 2007, Sun finished the process, making all of its JVM's core code available under free software/open-source distribution terms, aside from a small portion of code to which Sun did not hold the copyright.
  
    </p>
    <p>  
  
  Sun's vice-president Rich Green said that Sun's ideal role with regard to Java was as an evangelist.[33] Following Oracle Corporation's acquisition of Sun Microsystems in 2009–10, Oracle has described itself as the steward of Java technology with a relentless commitment to fostering a community of participation and transparency.[34] This did not prevent Oracle from filing a lawsuit against Google shortly after that for using Java inside the Android SDK (see the Android section).
  
    </p>
    <p>  
  
  On April 2, 2010, James Gosling resigned from Oracle.[35]

In January 2016, Oracle announced that Java run-time environments based on JDK 9 will discontinue the browser plugin.[36]

Java software runs on everything from laptops to data centers, game consoles to scientific supercomputers
  
    </p>
    <p>  
  
  There were five primary goals in the creation of the Java language:[17]

It must be simple, object-oriented, and familiar.
It must be robust and secure.
It must be architecture-neutral and portable.
It must execute with high performance.
It must be interpreted, threaded, and dynamic.
  
    </p>
    <p>  
  
  Sun Microsystems released the first public implementation as Java 1.0 in 1996.[26] It promised Write Once, Run Anywhere (WORA) functionality, providing no-cost run-times on popular platforms. Fairly secure and featuring configurable security, it allowed network- and file-access restrictions. Major web browsers soon incorporated the ability to run Java applets within web pages, and Java quickly became popular. The Java 1.0 compiler was re-written in Java by Arthur van Hoff to comply strictly with the Java 1.0 language specification.[27] With the advent of Java 2 (released initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple configurations built for different types of platforms. J2EE included technologies and APIs for enterprise applications typically run in server environments, while J2ME featured APIs optimized for mobile applications. The desktop version was renamed J2SE. In 2006, for marketing purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.
  </p>
  </article>
  </main>  
</body>
</html>
              
            
!

CSS

              
                html{
  
  display: block;
}


html,body {
display: grid;  
    min-width: 290px;
    color: #4d4e53;
    background-color: #ffffff;
    font-family: 'Open Sans', Arial, sans-serif;
    line-height: 1.5;
}

body {
    display: block;
    margin: 8px;
}


#main-doc header {
    text-align: left;
    margin: 0px;
}

header {
    color: black;
    margin: 10px;
    text-align: left;
    font-size: 1.8em;
    font-weight: thin;
}


@media (max-width: 600px){
  #navbar{
    overflow: scroll;
    position:fixed;
    top: 0;
    padding: 0;
    margin: 0;
    width: 100%;
  }
}

#navbar{ 
position: fixed;
top: 50px;
left:10px;
background-color: silver;  
}

nav {
    display: block;
}

#navbar a {
    display: block;
    padding: 10px 30px;
    color: #4d4e53;
    text-decoration: none;
    cursor: pointer;
}

#navbar li {
    color: #4d4e53;
    border-top: 1px solid;
    list-style: none;
    position: relative;
    width: 100%;
}
section {
    display: block;
}


code{
  background-color:grey;
  display: block;
  padding:20px;
}
@media #main-doc (max-width: 150px) {
  border: 10px solid; 
} 

#main-doc{
  
  position: absolute;
    top: 10px;
    left: 350px;
}
              
            
!

JS

              
                // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place. 

/***********
INSTRUCTIONS:
  - Select the project you would 
    like to complete from the dropdown 
    menu.
  - Click the "RUN TESTS" button to
    run the tests against the blank 
    pen.
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!
    ************/

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments. 

              
            
!
999px

Console