CompTIA IT Fundamentals+ (ITF+) Study Guide by Quentin Docter

CompTIA IT Fundamentals+ (ITF+) Study Guide by Quentin Docter

Author:Quentin Docter [Docter, Quentin]
Language: eng
Format: epub
ISBN: 9781119513094
Publisher: Wiley
Published: 2018-07-31T14:30:00+00:00


There are dozens of compiled languages a programmer can choose from, but unless there is a specific need, the programmer is likely going to go with one of the more common ones. In days past, the choices might have been Fortran, BASIC, or Pascal. Now, Java, C, C++ (pronounced C plus plus), and C# (pronounced C sharp) are the most popular. The Linux and Windows kernels are written in C. The rest of Windows is written mostly in C++, with a bit of custom assembly thrown in for good measure.

Let’s take a look at the source code for “Hello, world!” in Java, which is the most popular programming language in use today:

public class HelloWorld { public static void main(String[] args) { // Prints “Hello, world!” in the terminal window. System.out.println(“Hello, world!”); } }

Compare and contrast the Java code to assembly. A few things might jump out. First, the program is a lot shorter. Second, the syntax is different. Java uses braces (the { and }) to indicate code blocks. Notice that for every open brace, there is a corresponding close brace. Single-line comments in Java are preceded with two slashes (//) instead of a semicolon. Even little things—assembly uses single quotes around the words that you want to print while Java uses double quotes—are different. As for the rest of the context, don’t worry about understanding it all right now. Again, the point is to just get a feel for what some basic code looks like.

The next stop on your tour of compiled languages is C++. Let’s look at source code for your new favorite program:

// Header file #include<iostream> using namespace std; // the main function is where the program execution begins int main() { // the message to the world cout<<“Hello, world!”; return 0; }

There are a few similarities to Java. C++ and Java are both derivatives of the C language, so it makes sense that they would share some features. For example, comments start with two slashes, and braces are present to create blocks of code. Other things that you might have noticed are that both use a main function, double quotes for text, and a semicolon to end a statement.

Finally, take a look at the same program written in C#. C# is also a derivative of C, so some of this code might start to look familiar to you:

using System; namespace HelloWorld { Class Program { // the main function - also known as a method Static void Main(string[] args) { // the message to the world Console.WriteLine(“Hello, world!”); Console.ReadLine(); } } }

The indentation used in programming, in most cases, does not affect the functionality of the program. It’s there to make it easier for the developer (or other people looking at the code) to read. In the C# example, the indentation makes it easy to see that there are three open braces and three corresponding close braces. Again, for the IT Fundamentals+ (ITF+) exam, don’t worry about being able to read or write code in a specific language.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.