{"id":101687,"date":"2021-04-22T11:00:00","date_gmt":"2021-04-22T08:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=101687"},"modified":"2021-04-14T14:31:33","modified_gmt":"2021-04-14T11:31:33","slug":"java-programming-basics","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/","title":{"rendered":"Java Programming Basics"},"content":{"rendered":"<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems, Inc. in 1991. It is formally known as OAK. In 1995, Sun Microsystem changed the name to Java. In 2009, Sun Microsystem takeover by Oracle Corporation.<\/p>\n<p>In this tutorial, we are going to learn the basics of Java Programming. We will learn about the JRE, the basic syntax, how to add comments to the code, Variables, Data Types, Keywords, Operators, and Loops.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-java-runtime-environment\">2. Java Runtime Environment<\/h2>\n<p>The Java Runtime Environment, or JRE, is a software layer that runs on top of a computer\u2019s operating system and provides libraries and other resources that a Java program needs in order to run. The JRE is one of the three components needed for developing and running Java programs. The other two components are the Java Development Kit, or JDK, which is a set of tools for developing Java applications, and the Java Virtual Machine, or JVM, for executing Java applications. The JRE combines the Java code we created using the JDK, with the necessary libraries required to run it on a JVM and then creates an instance of the JVM that executes the program.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-java-basic-syntax\">3. Java Basic Syntax<\/h2>\n<p>Every line of code that runs in Java must be inside a class. A Java program is a collection of objects, and these objects communicate through method calls to each other to work together. A class name should always start with an uppercase letter. Note that Java is case-sensitive. Let&#8217;s see an example of <a href=\"https:\/\/examples.javacodegeeks.com\/java-syntax-rules\/\">Java syntax<\/a>. <\/p>\n<p><span style=\"text-decoration: underline\"><em>Hello.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class Hello {\n\n\/\/\tThis is a comment\n\tpublic static void main(String[] args) {\n\t\tSystem.out.println(\"Hello World\");\n\t}\n\n}\n<\/pre>\n<ul class=\"wp-block-list\">\n<li>line 1: This is how a java class is declared. The code that is running is inside the Hello class.<\/li>\n<li>line 3: We can also put comments inside our code. Comments are ignored by the JDK.<\/li>\n<li>line 4: This is the <code>main()<\/code> method and is necessary for every java program in order to run. Inside we put the main code that we want to run.<\/li>\n<li>line 5: This is the code we run for this example and prints to the console &#8216;Hello World&#8217;. <code>System<\/code> is a class provided by the JRE. It provides us with different methods. <code>out<\/code> is an instance of <code>PrintStream<\/code> type. <code>println<\/code> is a method of <code>out<\/code> instance. <\/li>\n<\/ul>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF.jpg\"><img decoding=\"async\" width=\"377\" height=\"92\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF.jpg\" alt=\"java programming - Hello.java Example Output\" class=\"wp-image-101748\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF.jpg 377w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF-300x73.jpg 300w\" sizes=\"(max-width: 377px) 100vw, 377px\" \/><\/a><figcaption>Fig. 1: Hello.java Example Output<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-4-comments\">4. Comments<\/h2>\n<p>As we saw in the previous example, we can also add <a href=\"https:\/\/examples.javacodegeeks.com\/java-comments\/\">comments<\/a>. We can indicate a single-line comment with two forward slashes (\/\/). Multi-line comments start with \/* and end with *\/. Any text between \/* and *\/ will be ignored by Java.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Hello.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class Hello {\n\n\t\/*\n\tThis is a multi-line comment\n\t*\/\n\tpublic static void main(String[] args) {\n\t\tSystem.out.println(\"Hello World\");\n\t}\n\n}\n<\/pre>\n<h2 class=\"wp-block-heading\" id=\"h-5-variables-and-data-types\">5. Variables and Data Types<\/h2>\n<p>We use variables to store data values. To create a variable, you must specify the <a href=\"https:\/\/examples.javacodegeeks.com\/java-data-types-example\/\">Data Type<\/a>, a name, and assign it a value: <code>DataType name = value;<\/code>. In Java, there are different Data Types of variables, for example:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<ul class=\"wp-block-list\">\n<li>String &#8211; Stores text. String values are surrounded by double-quotes. String text = &#8220;text&#8221;;.<\/li>\n<li>int &#8211; stores integers without decimals. <code>int x = 5;<\/code>.<\/li>\n<li><code>double<\/code> &#8211; stores number with the decimals. <code>double x = 5.0;<\/code>. <\/li>\n<li><code>boolean<\/code> &#8211; can only store two values: true or false. <code>boolean b = true;<\/code>.<\/li>\n<\/ul>\n<p><span style=\"text-decoration: underline\"><em>Hello.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class Hello {\n\n\t\/*\n\tThis is a multi-line comment\n\t*\/\n\tpublic static void main(String[] args) {\n\t\tString text = \"Hello World\";\n\t\tSystem.out.println(text);\n\t}\n\n}<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF-1.jpg\"><img decoding=\"async\" width=\"377\" height=\"92\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF-1.jpg\" alt=\"java programming - Hello World Example with Variable\" class=\"wp-image-101753\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF-1.jpg 377w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/ScreenshotF-1-300x73.jpg 300w\" sizes=\"(max-width: 377px) 100vw, 377px\" \/><\/a><figcaption>Fig. 2: Hello World Example with Variable.<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-6-java-keywords\">6. Java Keywords<\/h2>\n<p>Java keywords are also known as reserved words. These are predefined words by Java and cannot be used as a variable or object name. A list of these keywords can be found <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/nutsandbolts\/_keywords.html\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<p>Here is a tutorial for <a href=\"https:\/\/examples.javacodegeeks.com\/java-keywords-tutorial\/\">Java Keywords<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-operators\">7. Operators<\/h2>\n<p>Operator in Java is a symbol that is used to perform operations. For example: =, +, *, &amp; etc. There are many types of operators.<\/p>\n<ul class=\"wp-block-list\">\n<li>Simple Assignment Operator\n<ul>\n<li>= Simple Assignment Operator<\/li>\n<\/ul>\n<\/li>\n<li>Arithmetic Operators\n<ul>\n<li>+ Additive operator (also used for String concatenation)<\/li>\n<li>&#8211;  Subtraction operator<\/li>\n<li>*  Multiplication operator<\/li>\n<li>\/  Division operator<\/li>\n<li>% Remainder operator<\/li>\n<\/ul>\n<\/li>\n<li>Unary Operators\n<ul>\n<li>+ Unary plus operator indicates a positive value<\/li>\n<li>&#8211;  Unary minus operator negates an expression<\/li>\n<li>++ Increment operator increments a value by 1<\/li>\n<li>&#8212; Decrement operator decrements a value by 1<\/li>\n<li>!  Logical complement operator inverts the value of a boolean<\/li>\n<\/ul>\n<\/li>\n<li>Equality and Relational Operators\n<ul>\n<li>== Equal to<\/li>\n<li>!=  Not equal to<\/li>\n<li>>   Greater than<\/li>\n<li>>= Greater than or equal to<\/li>\n<li>&lt;   Less than<\/li>\n<li>&lt;= Less than or equal to<\/li>\n<\/ul>\n<\/li>\n<li>Conditional Operators\n<ul>\n<li>&amp;&amp;  Conditional -AND<\/li>\n<li>||      Conditional -OR<\/li>\n<li>?:      Ternary (shorthand for if-then-else statement)<\/li>\n<\/ul>\n<\/li>\n<li>Type Comparison Operator\n<ul>\n<li>instanceof  Compares an object to a specified type<\/li>\n<\/ul>\n<\/li>\n<li>Bitwise and Bit Shift Operators\n<ul>\n<li>~      Unary bitwise complement<\/li>\n<li>&lt;&lt;    Signed left shift<\/li>\n<li>>>    Signed right shift<\/li>\n<li>>>> Unsigned right shift<\/li>\n<li>&amp;      Bitwise AND<\/li>\n<li>^      Bitwise exclusive OR<\/li>\n<li>|       Bitwise inclusive OR<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Learn more in our <a href=\"https:\/\/examples.javacodegeeks.com\/basic-java-operators\/\">Java Operators Tutorial<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-8-loops\">8. Loops<\/h2>\n<p>Looping in programming languages is a feature that gives us the ability to execute a set of instructions while some condition evaluates to true. Java provides three ways for looping.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-8-1-while-loop\">8.1 While Loop<\/h3>\n<p id=\"h-while-loop-starts-with-the-checking-of-condition-if-it-is-true-then-the-loop-body-statements-are-executed-otherwise-the-loop-ends\">While loop starts with the checking of condition. If it is true, then the loop body statements are executed, otherwise, the loop ends. Here is an example.<\/p>\n<p><span style=\"text-decoration: underline\"><em>While.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class While {\n\tpublic static void main(String args[]) {\n\t\tint x = 1;\n\n\t\twhile (x &lt;= 4) {\n\t\t\tSystem.out.println(\"x = \" + x);\n\n\t\t\t\/\/ Increment the value of x for next iteration\n\t\t\tx++;\n\t\t}\n\t\tSystem.out.println(\"Loop ended\");\n\n\t}\n}<\/pre>\n<ul class=\"wp-block-list\">\n<li>line 3: we initialize a variable for the condition.<\/li>\n<li>line 5: checks if the statement is true, 1 less than or equal to 4 is true so we enter into the loop.<\/li>\n<li>line 9: we increment the value of x by 1 and the loop repeats. When x =5 the statement is false so the loop ends and the next line after the loop is executed.<\/li>\n<\/ul>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_2F.jpg\"><img decoding=\"async\" width=\"381\" height=\"107\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_2F.jpg\" alt=\"java programming - While Loop output\" class=\"wp-image-101757\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_2F.jpg 381w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_2F-300x84.jpg 300w\" sizes=\"(max-width: 381px) 100vw, 381px\" \/><\/a><figcaption>Fig. 3: While Loop output.<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-8-2-for-loop\">8.2 For Loop<\/h3>\n<p>For loop. Unlike a while loop, a for statement consumes the initialization, condition, and increment\/decrement in one line providing a shorter structure of looping. This is the same example as before, using the for loop.<\/p>\n<p><span style=\"text-decoration: underline\"><em>For.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class For {\n\n\tpublic static void main(String[] args) {\n\n\t\tfor (int x = 1; x &lt;= 4; x++) {\n\t\t\tSystem.out.println(\"x = \" + x);\n\t\t}\n\t\tSystem.out.println(\"Loop ended\");\n\t}\n\n}<\/pre>\n<ul class=\"wp-block-list\">\n<li> Line 5: Initialization condition: <code>int x = 1;<\/code>. Here, we initialize the variable in use. Testing Condition: <code>x &lt;= 4;<\/code>. If the statement is false the loop ends. If it is true, the loop body is executed. Increment\/ Decrement: <code>x++<\/code> It is used for updating the variable for the next iteration.<\/li>\n<\/ul>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_3F.jpg\"><img decoding=\"async\" width=\"366\" height=\"105\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_3F.jpg\" alt=\"Fig. 4: For Loop Output.\" class=\"wp-image-101759\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_3F.jpg 366w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_3F-300x86.jpg 300w\" sizes=\"(max-width: 366px) 100vw, 366px\" \/><\/a><figcaption>Fig. 4: For Loop Output.<\/figcaption><\/figure>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-8-3-do-while-loop\">8.3 Do&#8230;While Loop<\/h3>\n<p>Do&#8230;While loop starts with the execution of the body. Do&#8230;While loop will execute its body at least once. After the execution of the body, the condition is checked. If it is true, the next iteration of the loop starts. When the condition becomes false, the loop ends.<\/p>\n<p><span style=\"text-decoration: underline\"><em>DoWhile.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">public class DoWhile {\n\n\tpublic static void main(String[] args) {\n\t\tint x = 1;\n\t\tdo {\n\n\t\t\tSystem.out.println(\"x = \" + x);\n\t\t\tx++;\n\t\t} while (x &lt; 0);\n\t\tSystem.out.println(\"Loop ended\");\n\t}\n\n}<\/pre>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_4f.jpg\"><img decoding=\"async\" width=\"401\" height=\"67\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_4f.jpg\" alt=\"\" class=\"wp-image-101760\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_4f.jpg 401w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/Screenshot_4f-300x50.jpg 300w\" sizes=\"(max-width: 401px) 100vw, 401px\" \/><\/a><figcaption>Fig. 5: Do&#8230;While loop Output.<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-9-summary\">9. Summary<\/h2>\n<p>In these examples, we saw the basics of Java. Java is a very powerful programming language and there are a lot of things that someone can learn and eventually create his own program.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-10-related-articles\">10. Related articles<\/h2>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/java-tutorial-for-beginners\/\">Java Tutorial for Beginners<\/a><\/li>\n<li><a href=\"https:\/\/www.javacodegeeks.com\/learn-java-programming-online.html\">Best Way to Learn Java Programming Online<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/how-to-download-java-14-for-windows-10\/\">How to download Java 14 for Windows 10<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\">Java API Tutorial<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/java-constructor-example\/\">Java Constructor Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/try-catch-java-example\/\">Try Catch Java Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/printf-java-example\/\">Printf Java Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/for-loop-java-example\/\">For loop Java Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/java-switch-case-example\/\">Java Switch Case Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/arraylist-java-example\/\">ArrayList Java Example \u2013 How to use arraylist<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/java-map-example\/\">Java Map Example<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/polymorphism-java-example\/\">Polymorphism Java Example<\/a><\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-11-download-the-source-code\">11. Download the source code<\/h2>\n<p>This was an example of the basics in Java.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/04\/JavaBasics.zip\"><strong>Java Programming Basics<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems, Inc. in 1991. It is formally known as OAK. In 1995, Sun Microsystem changed the name to Java. In 2009, Sun Microsystem takeover by Oracle Corporation. In this tutorial, we are going to learn the basics &hellip;<\/p>\n","protected":false},"author":241,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1084,46709,46710,212,46708,546,46711,1044,641],"class_list":["post-101687","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-java","tag-data-types","tag-enviroment","tag-for","tag-java-basics-2","tag-jdk","tag-jre","tag-keywords","tag-operators","tag-while"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java Programming Basics - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems,\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java Programming Basics - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems,\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-22T08:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Odysseas Mourtzoukos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Odysseas Mourtzoukos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\"},\"author\":{\"name\":\"Odysseas Mourtzoukos\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc\"},\"headline\":\"Java Programming Basics\",\"datePublished\":\"2021-04-22T08:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\"},\"wordCount\":1085,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"keywords\":[\"data types\",\"Enviroment\",\"for\",\"java basics\",\"JDK\",\"JRE\",\"keywords\",\"operators\",\"while\"],\"articleSection\":[\"Core Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\",\"name\":\"Java Programming Basics - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2021-04-22T08:00:00+00:00\",\"description\":\"1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems,\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java Programming Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc\",\"name\":\"Odysseas Mourtzoukos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg\",\"caption\":\"Odysseas Mourtzoukos\"},\"description\":\"Mourtzoukos Odysseas is studying to become a software engineer, at Harokopio University of Athens. Along with his studies, he is getting involved with different projects on gaming development and web applications. He is looking forward to sharing his knowledge and experience with the world.\",\"sameAs\":[\"https:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/odysseas-mourtzoukos\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java Programming Basics - Java Code Geeks","description":"1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems,","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/","og_locale":"en_US","og_type":"article","og_title":"Java Programming Basics - Java Code Geeks","og_description":"1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems,","og_url":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-04-22T08:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Odysseas Mourtzoukos","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Odysseas Mourtzoukos","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/"},"author":{"name":"Odysseas Mourtzoukos","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc"},"headline":"Java Programming Basics","datePublished":"2021-04-22T08:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/"},"wordCount":1085,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","keywords":["data types","Enviroment","for","java basics","JDK","JRE","keywords","operators","while"],"articleSection":["Core Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/","url":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/","name":"Java Programming Basics - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2021-04-22T08:00:00+00:00","description":"1. Introduction Java is a high-level, general-purpose, object-oriented, and secure programming language developed by James Gosling at Sun Microsystems,","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-programming-basics\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-programming-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"Java Programming Basics"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/521138aa5aedaad0710ce6c488872ebc","name":"Odysseas Mourtzoukos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2021\/02\/Photo-96x96.jpg","caption":"Odysseas Mourtzoukos"},"description":"Mourtzoukos Odysseas is studying to become a software engineer, at Harokopio University of Athens. Along with his studies, he is getting involved with different projects on gaming development and web applications. He is looking forward to sharing his knowledge and experience with the world.","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/odysseas-mourtzoukos\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/101687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/241"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=101687"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/101687\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=101687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=101687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=101687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}