Java programming from scratch for dummies. Programming from scratch: where to start? How to start learning programming from scratch in Java? Testing at the end of the course

Hello dear reader. I have long wanted to write an article like this, but either I didn’t have enough time or treacherous laziness got in the way. But, be that as it may, I still managed to gather my thoughts to write something that, I hope, will bring you some benefit. I will be happy to share my knowledge and experience, in return you will receive time and attention. In my opinion, this publication is well suited for those who are ready to decide on their interests and want to connect their lives with IT - in one way or another. So, let's go!

Choosing a programming language

The publication is starting to look like many similar materials. According to the law of the genre, I will have to write the name of a couple of three programming languages, name a couple of pros and cons and, in the end, without answering the question, move on to the next part. Partly, there is some truth in this, because everyone chooses the language that is closer to them, based on what type of products they want to develop in the future. Most of you studied in school Turbo Pascal and it will hardly be news to you that almost nothing is written in this language now. So in in this case, you need to choose a language wisely, although you can never have too much knowledge, but if you want to effectively join the ranks of programmers in a short period of time, you need to approach the choice of language wisely. At the very beginning, remember: a good programmer will never go hungry, and in most cases will be able to buy himself a lot of caviar(this definition is suitable for any specialty, but no specialty will give you such freedom to choose where to work, both in terms of companies and countries - he is a programmer and a programmer in India).

It is logical that the more popular and in demand a language is, the greater the chances of finding a job in the future, and the language should be easy to learn. Because although they write in C++ a large number of games and get good money for it, a beginner, especially one not familiar with OOP (object-oriented programming), is better off putting this language aside for a while. The following link provides a list of the most popular programming languages ​​of 2014, and as you can see, Java is in first place, followed by C languages, then Phyton, JavaScript, PHP, Ruby, etc. If you look for similar statistics yourself, you will see that in different sources places are occupied differently, but in general the first 10 places in content will be the same everywhere.

If you turn to another one, which is based on an analysis of vacancies posted on Twitter, you will see a very similar situation with the first example. And yes, both articles are in English, get used to this, if you want to become a programmer, remember that almost all documentation and sources useful information are written in English, so if your knowledge of this language is weak, add learning and practicing English to your to-do list for tomorrow and the near future. I think I’ll even write a separate article dedicated to learning a foreign language.

Based on these two sources, we can already imagine which programming languages ​​are currently “in fashion”. As the title suggests, the author of the article chose Java for himself. Although I think it is the best for learning OOP, there are many people who will disagree with me, and this is logical - as many people, so many opinions. Here we stand at a small crossroads: choose Java, C# (very similar to Java), Phyton, if we want to work with the fillings of programs and applications (back-end) or PHP, JavaScript, HTML, if we want to do web development (front-end). In the first case, I would choose Java, and in the second, PHP, although again, it’s more to your taste, you have to look for information about it yourself various languages and generally understand what you want to do. For thought, here is a selection of languages ​​that are used in the largest Internet companies in the world.

There are 2 main reasons why I would choose either Java or PHP. The first is that these languages ​​are very popular and finding the appropriate job will not be difficult, and the second is that in no other languages ​​will you find as much training material as in these two, both in Russian and in English.

Education

So, we have come to a stage that most people reach without problems, but this period is rightfully one of the most difficult in a programmer’s career. Although a programmer learns throughout his life, the time when he begins to take his first steps largely determines his future fate. In general, training tests a person’s strength, whether he will endure it, whether he will not lose interest in a month (as happens with some), whether he will be able to reach the end and master basic knowledge, on which whole layers of information will then be layered.

In general, I have my own theory, which I have confirmed more than once in practice: Absolutely everything can be learned in 1 year.. Believe me, this is the absolute truth, some may even need less time, but if a person does not stop giving up and approaches learning wisely throughout the year, then it is almost impossible that he will not learn. This is not only in programming, in absolutely any area: if you want to play the guitar - no problem (it didn’t take me that much time and effort), learn Argentine tango, surf - all this is enough for one year. The main thing is to study!

In this case, I will consider the Java language, since it is still closer to me. Fortunately, the Internet is full of people who help others study for free, so finding material that is suitable for you will not be difficult. , which you can view with pen and paper within the walls of your cozy apartment (for now only in Russian). For those who are used to reading the material they are going through, the Internet again provides great opportunities and this is only one of all kinds of sites with Java lessons. There are more than enough theories, but I can’t say enough about a training site like Coursera.org, where you can find training courses in various languages ​​and languages. various areas, including programming - again, everything is absolutely free. There are not one or two such sites, you just have to search.

But no matter how informative the theory is, programming is indispensable without practice. But even here, half the work has already been done for us and we don’t need to look for various tasks to improve our skills; a service like JavaRush will help a lot with this. In general, this site provides both theory and practice, starting with simply duplicating code from the screen and ending with complex tasks, and during the breaks it even offers to relax and watch the well-known animated series. According to the authors, those who have reached level 20 in the service will have sufficient knowledge to already get a job in an IT company.

And of course, someone will ask, what about the book? Shouldn’t you read them, and if so, then what? To this I will answer that no one has ever become dumber from reading books. There are also a lot of books, but I will only list a small part of them:

Help with practice

As already mentioned, practice is an integral part of any learning, especially in programming. Here you will have to code and code, right down to the muscle memory of your fingers. This, of course, is a little exaggerated, but at first you will really have to hit the keys a lot in order to remember the meanings of various structures so that in the future you can use them almost automatically.

Many novice programmers have a lot of questions at first, especially when they need to complete an independent task. This is fine. But in such situations, you need to understand that almost any question you have can be answered on the Internet. It’s unlikely that you’re the first person to encounter it, so don’t rush to immediately ask questions on various programmer forums (which I’ll write about a little later). Sit for a minute, correctly formulate the problem in your head and feel free to look for it in a search engine. Surely most will search in Russian, but don’t forget that the language of programmers is English, so if you haven’t found the answer in the great and mighty, it’s worth looking in a language that everyone seemed to have studied at school, but never learned. But even if in this case it turns out that there is no answer to your question anywhere, they enter into battle best forums Internet:

  • Cyberforum is, in my opinion, the most popular Russian-language forum for IT specialists, here you can find answers to questions, and not only in the field of programming;
  • Programmers forum - a large Russian-language forum;
  • Searchengines is a well-known forum, but specializes more in web programming;
  • Stack overflow - and this, I’m not afraid of these words, is already the most popular IT forum in the whole world, you will find answers to almost all your questions here;
  • Dev shed is also a large English-language forum;
  • Quora is a forum that does not specifically specialize in programming, but there is a high probability that you will receive an answer from a real professional.

Forums are, of course, not the only way to get answers to your questions. In their practice, programmers everywhere work with official documentation the language in which they write. It describes how certain classes and interfaces work, sometimes documentation is the only source that can help resolve issues, because it’s only at the initial stage that everyone has similar questions and can be found without problems ready-made solutions, but the further you get into the wilds, the harder and harder it is to find answers, so you have to rely on your, I hope, already smart head.

Compiling the code

I have already written quite a lot, of course, it is difficult to cover such a large topic in one article, but I think the first steps have already been taken and they should evoke the appropriate thoughts in you. I think this is only the first article in the series “How to become a programmer” and, accordingly, “why?” if you are at a crossroads and don’t yet know which path to choose. Next time I will touch on more materially interesting things, because it’s no secret that programmers are not poor people, and we’ll see where and how much they get paid next time.

Finally, for those who really want to become a programmer, I wish you to take the bull by the horns, gather all your will into a fist and do what you like. It has been said thousands of times before, but I will repeat, the main thing is desire and work. Then everything will work out for you. Remember the most important thing: perceive learning programming languages ​​and various technologies not as a goal, but as a MEANS. Just imagine what opportunities are opening up to you. Maybe you will become one of those who changes the world in real time. So good luck and thanks for your attention!

Video bonus

Tags:

  • how to become a programmer
  • learn programming
  • learn java
Add tags

Learning Java can be a headache if you are a beginner and don't know where to start. Why? Yes, if only because before you start learning programming, you need to prepare your computer. You need to install everything you need to start developing programs. But don't worry—we'll prepare you for it, so you'll be prepared when you start. However, it is worth warning you that before you start developing web applications in Java, you will definitely need to learn HTML + CSS layout, and you can do this by visiting our.

Let's start with a small digression. Java is a high-level, object-oriented programming language developed by Sun Microsystems. There are a number of benefits to learning Java. For example, the fact that this is a fairly powerful tool for developing cross-platform applications for both regular computers, so mobile applications, web applications and can even be used in robotics! Whether your computer has Windows, Linux, or even Mac OS installed, there is absolutely no difference for Java - it runs on its own special virtual machine.

A small list for preparation.

First things first, before you write your first Java program, you need to install what is called the Java Virtual Machine (JVM), also known as Java Runtime Environment (JRE). You can install it using the following link:

When that's done, you still need to install Java's software development kit (JDK) from the following link:

What's the next step? How to compile and run Java programs?

Before moving on to the next step - choosing an IDE, let's figure out how Java programs generally work. You write some program code in a specialized text editor(NetBeans, Eclipse, Idea), this code is called program source code and is saved with the file extension .java. The Java compiler (Javac) turns this source code into a special encoded file with the extension .class. Once you have this file, you can run it in a Java Virtual Machine (JVM) without any problems. So, we have understood the basic concepts and we can move on.

Selecting a source code editor (IDE).

The IDE (Interface Development Environment) takes care of program compilation and other things behind the scenes. Here's a small list to choose from:

1. Eclipse is a free and very powerful editor.

2. NetBeans - also free, but a little less popular.

3. IntelliJ Idea - paid and extremely convenient editor. It is a corporate standard in many companies.

Learning to walk before learning to run - Hello world!

Hello World! is a classic example for learners and helps beginners understand the language. So, you have already installed the editor you like. Now you need to create new project and create in it new class(Class), let's call it FirstProject.

Your code should look like this:

Java

public class FirstProject(

* @param args

public static void main (String args) (

// TODO Auto-generated method stub

Code comments are indicated after “//” and are written on one line. For multi-line comments, use "/* */". Comments are ignored by the compiler and have no effect on program execution.

The skeleton of your program.

Everything enclosed in curly braces () is called a block. Take a close look at the main() method. This is the block that will be executed line by line as the program progresses. This is extremely important. You may ask what these keywords are for public static void? This is a broad enough topic to include in a short article, so I can recommend going through our good .

So, you have a FirstProject class with a main() method.

We are writing our first program.

In the curly braces of the main method, add the following line.

A selection of materials on Java. If you study it, you will definitely find something useful for yourself, no matter what stage of study you are at.

The list is compiled taking into account the release of updates in the language. For better orientation, all books have their own category.

Newbie

This book is ideal for those who are just starting their journey in programming in this language. Here you can find everything you might need and necessary for a programmer at first. It consists of 17 chapters, each of which will introduce you to the basics of the language, its basic principles and capabilities. The book also touches on the principles of working with the Swing library and the JavaFX platform, which will certainly enrich the developer’s knowledge.

This irreplaceable tutorial on writing, compiling and executing programs in the Java programming language. The depth of the material will help the reader collect a lot of necessary information that will facilitate and embellish the development of programs in this language.

The book contains a set of useful rules that will make it obvious what to do and what not to do in order to make the code as efficient and clean as possible. Each rule is accompanied by examples for better understanding.
Features of the language and libraries will also be considered. Many different working techniques, advice from experienced developers. All of this together will help you get the most out of this development platform.

Knowing the basics for in-depth study

The book is a comprehensive guide and reference for programmers who already have experience in development. The information is updated in accordance with all innovations in the language. If you are a serious programmer and decide practical problems, then this is the perfect guide for you. Thanks to it, you will achieve a deep understanding of the language and its libraries. This volume focuses on the basics of the language and programming principles. user interface. You'll also explore a variety of topics, from the principles of object-oriented programming to the latest techniques in parallel and functional programming.

For a professional

Anyone familiar with the Spring framework should first read its documentation. Primarily due to the fact that from here you can find a treasure trove of treasures that will be useful in practice. The documentation contains information about all the features of Spring. It is also suitable for those who are just getting acquainted with a new area of ​​knowledge and opportunities that open up using this framework.

The book is suitable for all those who want to improve the efficiency of their work with the Java EE software platform. Patterns are considered here from all sides, both theoretically and practically, using examples of solving applied problems.
The reader will be introduced to the core and distinctive features of Java EE7.

The book is on a fairly narrow topic, but this does not make it any less useful. It will be useful for people with different programming experience who have not yet worked with functional programming.
From the book you will learn how to use lambda expressions and how they can increase productivity. The book will become your guide to making code simpler and better, introducing you to the skills of working with libraries. The information is accompanied by an abundance of examples and impeccable explanations, which will make studying the topic more interesting and useful.

And website creations are becoming more popular and attracting attention huge amount of people. Even a person without special education can start developing programs; the main thing is the desire and desire to learn new material and constant practice.

Study Options

Where to start learning programming from scratch? There are several ways to master new material in this area. Private teachers will show you how to start learning programming from scratch and teach you important aspects of building code. However, this method is quite expensive, so the following teaching methods are mainly used:

  1. Specialized courses. Their cost is much less than lessons from a personal tutor. It is worth noting that many employers respond positively to the availability of a variety of certificates of completion of training in computer academies. Pay attention to the courses of the world-famous companies Microsoft and Cisco.
  2. Deleted free courses. There are a very large number of services on the Internet with which you can view lecture courses from Oxford, Harvard and other famous educational institutions peace. There are also special platforms for training practical programming skills. Learn more about remote learning and useful Internet services read further in the article.
  3. Self-learning. Where to start learning programming from scratch if you don't plan to enroll in courses and spend money? In this case, the easiest way is to educate yourself. You should start studying by reading the basics, do not delve into theory, immediately start practicing, because only in the process of creating a program will you acquire the necessary skills.

After choosing the training option that suits you, you should decide on the subject area, because programming has a fairly wide range of different branches.

How to choose the right direction?

Directly depends on the type of software you will create in the future:

If salary is the most important factor for you, turn your attention to the job market. Nowadays, the most in demand are developers who specialize in the languages ​​Java, C#, ASP.NET, C++.

Low and high level languages. Difference and Applications

It is believed that all programming languages ​​are divided into high-level and low-level. Low level code is easier for a computer to process, but writing it takes a lot of time and requires more knowledge in subject area. Such languages ​​(for example, assembly) are used to write software for digital chips and microcontrollers. They are not very convenient for learning programming from scratch. The following in the article will tell you where to start writing your first programs: useful services and literature from world famous authors.

High-level languages ​​are much easier to use because they use built-in libraries to simplify and visualize code. Most modern software is written using languages high level.

Programming from scratch: where to start applications?

The process of creating mobile programs allows programmers to work with the latest tools and, as a result, earn a decent amount of money through monetization. First you need to choose the site where you will work:

  1. Google Play. Application store for users of the Android operating system. This OS has the largest share of users on the market. Java and C/C++ languages ​​are used to develop applications and games. The most popular are messenger applications and clients. social networks, cloud storage, games.
  2. Windows Mobile Store. This store is rapidly gaining popularity along with smartphones from Microsoft. In the CIS countries, most users prefer tablets on the platform Windows Phone. Programming applications for such a store helps you earn more money from monetization, because, unlike Android, almost all programs in the Windows store are distributed on a paid basis.
  3. App Store. Another profitable platform for development (language - Objective-C). The process of creating programs for devices Apple Requires a pre-installed development environment called Xcode. Next step you need to learn Objective-C programming from scratch. David Mark's book “Learning C for Mac” will tell you where to start writing code. Second edition."

Java language

Most professional developers recommend starting your programming knowledge with the Java language. It is easy to learn and at the same time in demand in the market. Use the tips below if you decide to learn programming from scratch. Where to start with Java development?

Java is a high-level object-oriented programming language that is needed for the development of most modern web applications and games. The process of compiling (turning written code into a language that a device can understand) turns the code into a sequence of bytes, so the program can be easily tested on any Java virtual machine.

Programming from scratch. Where to start with Java and Web coding?

The Java language is widely used in web development. Before you begin the full-fledged programming process, you should study Java, PHP, MySQL, HTML, CSS. A more detailed explanation of these concepts is given below:

  1. Java - used in writing utilities for websites and writing the logic of web page functionality.
  2. PHP is a language for creating personal website pages. It has a script structure. The leading language in creating dynamic websites that are popular today. PHP is needed to understand scripting and programming from scratch. Where to begin? From reading Josh Lockhat's book "PHP: The Right Way".
  3. MySQL is a system for managing the basics of data. Widely used in creating websites that require storing large amounts of grouped data.
  4. HTML is not a programming language. This is a markup language used to write the base of a web page (building blocks, distributing text and paragraphs, and so on).
  5. CSS - Cascading Style Sheet. Used only in conjunction with HTML to give the markup language style and appearance.

Only after finding out basic concepts With the milestones of these technologies, you can start creating professional dynamic websites that are in great demand today.

Web programming. Relevance and features

The topic of Web programming is especially relevant today. As stated above, to start developing web elements you need to have a fairly large amount of knowledge about markup languages, creating scripts, logic and styles.

Nowadays you won’t surprise anyone with sites that were created only with using HTML and CSS, so web developers who are able to make a website visually beautiful and also fill it with all the functionality necessary for users have become in demand.

This type of development requires the creation of two types of the same program: server and client parts. The programmer must understand the principle of operation of the so-called sockets - data packets that allow the necessary flows of information to be transmitted over the network between the server and the client.

Creating applications for the Windows operating system

To develop such programs, you will need knowledge of the C# language. Free service from Microsoft called Virtual Academy will allow you to learn all the features of this language and practice writing simple applications.

According to Microsoft's new policy, all applications are uploaded to the software store, so you can gain access to monetize your project.

The C family of languages ​​(C, C++, C#). Peculiarities

Programming from scratch - where to start choosing a language? The answer to this question can be obtained by delving into more detail into the types of application creation technologies. The relevance of a particular language should also be taken into account.

The languages ​​C, C++, C# have one common feature- availability of OOP (object-oriented programming) function. This technology allows you to significantly simplify the process of writing program code. Each software object is described in a specific class and has its own parameters, methods and properties. Thus, the programmer does not have to write huge pieces of code each time if the same object needs to be used several times.

Useful Internet services for learning the basic principles of programming and the code structure of any application

At the first stage of training, almost any web service will offer you to try its capabilities using Pascal, the simplest of the high-level languages. It is used for educational purposes and is taught in schools and technical colleges so that students can understand programming from scratch. Where to start with Pascal coding? First of all, you need to download the development environment to your PC. This is a small executable file in which the program code will be written. Use TurboPascal, because it is the most popular environment for learning this programming language.

HourOfCode is a web service from Microsoft. It is intended to clearly show students what a cycle, variable, class, and conditions are. The learning process is like a game.

CodeAcademy is a powerful resource for learning almost any coding technology. By devoting just an hour a day, you won’t even notice how you will learn to program and create your own projects.

Udacity is a service that provides its users free access to lectures by eminent professors and developers.

Gaining initial experience. Freelancing

After learning the basic principles of your chosen language, you can safely begin your first projects. Start freelancing, because this is how you will fill out your portfolio and gain experience communicating with customers. Such skills will be useful in the future if you want to get a job in a company as an official developer. software.

Bottom line

Programming from scratch: where to start? For dummies, professors from world-famous universities advise practicing with the basic structures that form the basis of any programming language. Enroll in specialized courses or self-study by listening to lectures online.

06.11.17 9551

IN this manual We'll tell you everything you need to know before you start studying. programming in Java. You will learn about the capabilities of the platform, its application, and how to start learning Java correctly.

What is the Java programming language?

In 1991, the "Green Team", a division of Sun Microsystems, led by James Gosling, created a language for programming consumer electronic devices. At that time it was called Oak (“Oak”). Why "Oak"? Simply because this tree grew outside the window of Gosling’s office.

The Green Team demonstrated the use of Oak in an interactive TV. But for digital cable television In those years, this technology was too advanced. At the same time, the Internet was gaining popularity, for which new language programming was the best fit.

After some time, the new language was renamed Green, and after that - Java, in honor of coffee from the island of Java. That's why the Java logo features a coffee mug.

During Java development C/C++ was popular, so Gosling made the language syntax similar to C/C++ and implemented the “ write once - run anywhere" In 1995, Sun Microsystems released the first official version Java. And at the same time it was announced that Java would be included in the Netscape Navigator browser.

In 2010, Sun Microsystems, along with the Java programming language, was acquired by Oracle Corporation.

Java version history

  1. June 1991 – start of the development project programming language Java.
  2. JDK 1.0 – January 1996.
  3. JDK 1.1 – February 1997.
  4. J2SE 1.2 – December 1998.
  5. J2SE 1.3 – May 2000.
  6. J2SE 1.4 – February 2002.
  7. J2SE 5.0 – September 2004.
  8. Java SE 6 - December 2006.
  9. Java SE 7 – July 2011.
  10. Java SE 8 – March 18, 2014.
  11. Java SE 9 – September 21, 2017.

Java Programming Language Features

Java is a cross-platform language

Java code written on one platform ( that is, the operating system), can be run without modification on other platforms.

For Java launcher used virtual machine Java ( Java Virtual Machine, JVM). The JVM processes the byte code, after which the processor processes the code received from the JVM. All virtual machines work similarly, so the same code runs the same on all operating systems, which is what makes Java a cross-platform programming language.

Object-oriented programming language

There are different styles of programming, and one of the most popular is object-oriented programming. With this approach complex problem is broken down into smaller ones by creating objects. Thanks to this, the code can be reused.

Object-oriented functions are found in many programming languages, including Java, Python, and C++. If you're serious about learning to program, object-oriented approaches are worth adding to your learning plan.

Java is fast

Early versions programming language Java has often been criticized for slow work. But today the situation has changed dramatically. New versions of the JVM run much faster, and the processors that interpret them are becoming faster and faster.

Today Java is one of the fastest programming languages. Well-optimized Java code runs almost as fast as low-level programming languages ​​such as C/C++ and much faster than Python, PHP, etc.

Java is a secure platform

Java is:

  • a secure platform for developing and launching applications;
  • provides funds for automatic control memory, which reduces code vulnerability;
  • provides secure transfer data.

Extensive core library

One of the reasons for the widespread use of Java is the huge standard library. It contains hundreds of classes and methods from various packages that make life easier for developers. Eg,

java.lang is advanced functions for strings, arrays, etc.

java.util – library for working with data structures, regular expressions, date and time, etc.

kava.io - library for file input/output, exception handling, etc.

Application of the Java Platform

Before learning Java programming from scratch, you need to know that more than 3 billion devices around the world work on this platform. What exactly can it be used for:

  1. Android Applications - To develop Android applications, the Java programming language is often used in combination with Android SDK (from English software development kit - software development kit).
  2. Web Applications - Java is used to create web applications using server programs, Struts framework and JSP. Some popular web applications written in Java are: Google.com, Facebook.com, eBay.com, LinkedIn.com.

It's worth noting that these sites are not necessarily written exclusively in Java, and may use other programming languages ​​as well.

  1. Software development– such programs as Eclipse, OpenOffice, Vuze, MATLAB and many others are written in Java.
  2. Big Data processing – to process “big data” you can use the Hadoop framework written in Java.
  3. Trading systems– using the platform Oracle Extreme Java Trading Platform, you can write programs for trading.
  4. Embedded devices– today billions of devices, such as TVs, SIM cards, Blu-ray players, etc., are based on Java Embedded technology from Oracle.

Also programming in Java is used to develop games, scientific applications ( for example, for natural language processing) and in many other areas.

Java Terminology You Should Know

Java is a set of technologies ( programming language and computer platform), designed to create and run software. However, the term Java often refers to the programming language itself.

Programming language Java is a cross-platform, object-oriented, general-purpose programming language with extensive capabilities.

Java 9 is the latest version of Java at the time of this writing.

Java EE, Java Me and Java SE - these names stand for Java Enterprise Edition, Micro Edition and Standard Edition, respectively.

Java EE is aimed at applications that run on servers. Java ME is designed for power-constrained devices such as embedded devices. Java SE is the standard edition of Java for writing general programs.

If you are new to Java programming, we recommend starting with Java SE.

JVM - Java Virtual Machine (" Java virtual machine") is a program that allows a computer to run programs written in Java.

JRE – Java Runtime Environment (“ Java runtime") includes the JVM, associated libraries, and other components needed to run programs. But the JRE does not have a compiler, debugger, or other development tools.

JDK - Java Development Kit(set Java developer) contains the JRE and other development tools such as compilers, debuggers, etc.

How to run Java on your operating system

How to Run Java on Mac OS

Here's what to do for Java programming from scratch and installing the platform on Mac OS X or macOS:

  1. Download the latest version of Java ( JDK) with Java SE download pages.
  2. Double-click on the downloaded DMG file and follow the instructions of the installer.
  3. To verify the installation, open a terminal and enter next command:

javac –version

If Java is installed correctly, the program version will be displayed on the screen ( for example javac 1.8.0_60).

The next step is to install the IDE ( integrated development environment) for writing and running Java code. We will install the free version IntelliJ IDEA and run Java on it. Here's what you need to do to do this:

  1. Go to IntelliJ download page and download the free Community Edition.
  1. Open the downloaded DMG file and follow the installation instructions. For quick access, you can move IntelliJ IDEA to the Applications folder.
  2. Open IntelliJ IDEA. Select the option “Don’t import settings” (“ Don't import settings") and click "Ok". After this, accept the Jetbrains privacy policy by clicking on the “Accept” button.
  3. Now you can customize the interface for yourself. You can also skip this step and leave everything as default. If you are not sure, just skip this step by clicking the “Skip All and Set Defaults” button (“ Skip everything and set to default settings»).

  1. The program will show you a welcome page. Click on the button “Create New Project" (“ Create a new project»).
  2. In the next window, select "Java" in the left pane and click "New" at the top of the program window to select "JDK". Here you need to select the location where you installed the JDK, and then click Next.

  1. You will have the option to create a project from template (“Create project from template”). We ignore it and click the “Next” button.
  2. In the next installation step programming language Java enter the project name and click the "Finish" button.
  3. In the left panel you will see your project. If the panel is not visible, go to the menu Views > Tool Windows>Project.
  4. Go to Hello > New > Java and give the class a name. We called it First.

  1. To run the program you just wrote, go to Run > Run... Click on First ( that is, the name of the file we created

How to Run Java on Linux

To run examples from programming lessons from scratch Java on Linux will need the JAVA SE Development Kit ( JDK) and IDE for developing your projects. Follow the instructions step by step to get started with Java.

Install Java

  1. Open a terminal and type the following command to install Java:

    sudo add-apt-repository ppa:webupd8team/java


    sudo apt update; sudo apt install oracle-java8-installer

  1. Accept license agreement and terms of use by clicking “OK” and “Yes”, respectively.
  2. You have installed Java. To verify that the installation was successful, enter the following command in a terminal:

java –version

If it is displayed Current version, installation was successful. If not, check with Oracle help page.

Installing IntelliJ IDEA

  1. Go to .

  1. Download the free Community Edition by clicking the "Download" button.
  2. After downloading change the directory in the terminal to your downloads directory and extract the Java tar file into the /opt folder with the following command:

sudo tar xf .tar.gz -C /opt/

  1. After unpacking, change the directory to bin folder IntelliJ IDEA programs:

    cd /opt/ /bin

  2. To start the IDE, enter the following command:
  3. Select “Don’t import settings” (“ Don't import settings") and click "OK". After this, we accept the Jetbrains privacy policy by clicking on the “Accept” button.
  4. Now for the passage programming courses Java, you can customize the interface for yourself. Create a shortcut on your desktop for quick access to the program. After that, to launch the IDE, click “Next" at all the following stages.
  5. The program will show the welcome page. Click "Create New Project" (" Create a new project»).
  6. In the next window, select "Java" in the left pane and make sure that Java is selected in the Project SDK line. If not, then select the location where you installed JDK: /usr/lib/jvm/java-8-oracle.

  1. Click “Next” twice and create a project.
  2. In the next step, enter a project name and click the “Finish” button. Now you will see your project in the left panel. If this panel is not visible, go to the menu Views > Tool Windows > Project.
  3. Add a new Java class. Select src in the left pane with the right click and go to New > Java Class. Provide a class name. The class name must not contain spaces.

  1. Write the Java code and save the project.
  2. To run the program, go to Run > Run... Click on HelloWorld ( Project name) - the program will compile the file and run it.

How to Run Java on Windows (XP, 7, 8 and 10)

To master Java programming basics and running the platform on Windows, you will need a JAVA SE Development Kit (JDK) and an IDE for developing projects. Follow step by step instructions given below:

Installing Java

  • Go to download page Java Standard Edition Development Kit.
  1. In the Java SE Development Kit section at the top of the table, click "Accept License agreement" (" Accept the license agreement"). Then click on the Windows (x64) link if you have a 64-bit operating system or Windows (x86) if you have a 32-bit OS.

  1. After downloading, run the installation file and follow the instructions that appear on the screen. Click " Next" Select all functions by pressing " This feature will be installed on local hard drive " and copy the installation location ( it is highlighted in yellow) in Notepad, then click again Next».

  1. During the installation process, you will be asked to JRE installation. Click "Next" and then "Finish" to complete the installation.
  2. Now you need to edit PATH variable. Go to Control Panel > System and Security > System. In the left pane, select " Extra options systems."

  1. Click " Environment Variables» . In chapter " System variables" Find the PATH variable and in the next window click "Edit".

  1. Select all text in the " Variable value" and copy it to a separate text file. This will make it easier to edit and check for errors. See if the copied text contains the line: C: ProgramData Oracle Java javapath; . If yes, then you can move on to the next step. If not, then paste the installation location you copied earlier at the beginning of the variable and add bin at the end of the line like this: C : Program Files (x 86) Java jdk 1.8.0_112 bin ;

  1. Click " Please note that your JDK version (jdk 1.8.0_112) may be different. Copy the value of the variable and paste it into the PATH box. OK
  2. " to save your changes. To check if the platform is installed correctly introduction to programming Java, open command line by typing cmd in the line Windows search or through the command “Run…” ( Windows - R Oracle help page.

Installing IntelliJ IDEA

  1. Go to ). Enter the java -version command. If the current version of Java is displayed, the installation was successful. If not, check with.
  2. IntelliJ IDEA download page

  1. Download the free Community Edition by clicking "Download".

  1. Once downloaded, run the installation file and follow the instructions that appear on the screen. Then create a desktop shortcut for the 64-bit version and add associations with the .java extension. Click "Next" and continue with the installation.
  2. Once installed, open IntelliJ IDEA by clicking on the desktop icon. Don't import settings Select "Don't import settings" ("
  3. ") and click "OK". After this, we accept the Jetbrains privacy policy by clicking “Accept”.
  4. Now you can customize the interface for yourself. You can also skip this step and leave everything as default by clicking the “Skip All and Set Defaults” button. Create a new project»).

  1. The program will show the welcome page. Click "Create New Project" ("
  2. In the next window, select "Java" in the left pane and click "New" at the top of the program window to select JDK. Here you need to select the location where you installed the JDK during the Java installation, and then click “Next”.
  3. On the next screen, enter the project name: HelloWorld and click Finish. If the program says that the directory does not exist, click OK. If you don't see the left pane, go to Views > Tool Windows > Project.
  4. To set the class name, select the src folder in the left pane. Right-click on it, go to New > Java and set the class name. The class name must not contain spaces.

  1. Write the code and save the Java project programming lesson.
  2. To run the program, go to the menu Run > Run... Click on HelloWorld - the program will compile the file and run it.

Your first Java program

To introduce users to a new programming language, they use the Hello World program (“Hello, world!”). This is a simple program that displays the words Hello, World! In this section we will teach you how to write this program in Java using IntelliJ IDEA.

  1. Open IntelliJ IDEA.
  2. Go to File > New >
    1. Click the start button ( Run). If everything is in order, you will see Hello, World! on the screen.

    How to learn Java?

    Official Java Documentation

    Oracle, the company that owns Java, publishes quality tutorials. The official documentation covers all Java features and is updated regularly.

    Note: the only negative is that the official Java documentation is not always written in the simplest language.

    If you really want to learn programming in Java, buy a good book. Of course, 1000 pages cannot be read in one day. But a good tutorial will help you learn programming.

    Java: Complete Guide(10th edition)

    A great book for those just starting to learn Java. The latest edition includes all the features of the Java 8 release.

    The book covers everything you need to know about Java programming, including syntax, keywords, and fundamentals programming, as well as a library Java API, Java applets and much more.

    Java Philosophy (4th Edition)

    If you are switching to Java from another programming language, this book is for you. If you are starting from scratch, it is best to read it together with the other.

    Java 8 Pocket Guide: Ambulance Java programmers

    This book contains clear answers to questions that arise when teaching J ava programming from scratch. It briefly covers all the basic Java concepts (including Java 9). Don't want to flip through hundreds of pages looking for the right line? Buy this book.

    Instead of a conclusion

    If you start learning Java, you can't go wrong - it is a promising programming language, full of a wide variety of possibilities.

    Before you start learning Java, use a few tips:

    • Don't read educational articles and examples like a novel. The only way to become a good programmer is to write a lot of code.
    • If you are switching from another programming language ( Let's say we haven't voted yet

      Good bad