How Java Works

注释 · 39 意见

Code is instructions that a computer can follow.
Programmers have to read code. The very act of debugging, for example, is reading your code and looking for a defect to fix. Programmers, on the other hand, read code in a very different way than computers do. When we read code, humans:

Code is instructions that a computer can follow.
Programmers have to read code. The very act of debugging, for example, is reading your code and looking for a defect to fix. Programmers, on the other hand, read code in a very different way than computers do. When we read code, humans: misunderstand things

Java course in Aurangabad
skip over simple or boring things. make incorrect assumptions.
Obviously, computers can’t do this. Computers need code that it can translate into instructions. This code must be:
unambiguous
grammatically sound logically possible (such as no null pointers)
In the earliest forms of programming, each machine operation was meticulously defined one at a time, frequently using mechanical or physical inputs to send instructions to the computer. Often, these instructions were written in a form of binary. The thing is, computers today fundamentally work the same way; we’ve just replaced the mechanical parts with small, faster electronic parts. We’ve traded in punch cards for keyboards, but we still have to write precise code.

Java classes in Aurangabad
From the software side, we found that writing code in binary was cumbersome, time-consuming, and error–prone. As a result, efforts to create readable languages began. Early languages, like Fortran, added human-readable identifiers, like “IF”, “PRINT”, etc. You can see such structure in this [Greatest Common Divisor code] (https://en.wikibooks.org/wiki/Fortran/Fortran_examples#Greatest_common_divisor) for Fortran 77.
Compiling
It’s important to understand that, when you write source code in modern high-level language, your computer actually can’t run your source code directly.Typically, we write code, and compile that code into something that can be executed by the computer. The below diagram is a simplification of this relationship:
The image depicts the source code, which has an arrow pointing to a box labeled Executable File and another arrow pointing to a box labeled Code Compiler. Compiling in C

Java Training in Aurangabad
Before talking about Java, let’s talk about how C works, and how it C code is turned into an executable program.
I can save the above code as helloWorld.c in any plain-text editor like Notepad (but not in "document editors" like Word). A screenshot of the helloWorld.c source code in Notepad Now, if I save this file to a folder called “code”, I can open a terminal (Mac/Linux) or Powershell1 and navigate to that folder. If I use the “ls” (list) command, I can see the file in my directory.
A screenshot of a terminal window with the command ls, which displays a file list that includes helloWorld.c However, that’s all I can do with it. My Windows operating system believes that I am attempting to "open" the file if I attempt to run it as if it were a program. When I typed helloWorld.c into my terminal, a pop-up window asks me what I want to open the file in, suggesting several text editors

Java course in Aurangabad
This is because source code is not a program that can be run. Source code is meant for humans. We write the source code using a programming language because it’s easier to read than those low-level machine instructions. If we want to run our program, we must compile it.

注释