From 720f1e9afa2a2f98d61939b6e6ac47195ee92a49 Mon Sep 17 00:00:00 2001
From: Arghya Ghosh <71373838+uiuxarghya@users.noreply.github.com>
Date: Tue, 2 Nov 2021 21:07:52 +0530
Subject: [PATCH 01/37] Update sitemap.xml
---
public/sitemap.xml | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/public/sitemap.xml b/public/sitemap.xml
index fca89b4d..025f0b0e 100644
--- a/public/sitemap.xml
+++ b/public/sitemap.xml
@@ -9,67 +9,77 @@
© {new Date().getFullYear()} Javaistic. All rights reserved.
- - + +Privacy Policy
- +Terms & Conditions
Date: Mon, 8 Nov 2021 04:18:53 +0530 Subject: [PATCH 08/37] Create comments.mdx --- src/pages/docs/comments.mdx | 100 ++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/pages/docs/comments.mdx diff --git a/src/pages/docs/comments.mdx b/src/pages/docs/comments.mdx new file mode 100644 index 00000000..65521529 --- /dev/null +++ b/src/pages/docs/comments.mdx @@ -0,0 +1,100 @@ +--- +title: Java Comments +description: In this tutorial, you will learn about Java comments, why we use them, and how to use comments in right way. +--- + +import { Heading } from '@/components/Heading' +import Link from 'next/link' +import { TipInfo } from '@/components/Tip' + + +In computer programming, comments are a portion of the program that are completely ignored by Java compilers. They are mainly used to help programmers to understand the code. For example, + +```java +// declare and initialize two variables +int a =1; +int b = 3; + +// print the output +System.out.println("This is output"); +``` +Here, we have used the following comments, + +- declare and initialize two variables +- print the output + +## Types of Comments in Java + +In Java, there are two types of comments: + +- single-line comment +- multi-line comment + +### Single-line Comment + +A single-line comment starts and ends in the same line. To write a single-line comment, we can use the `//` symbol. For example, + +```java +// "Hello, World!" program example + +class Main { + public static void main(String[] args) { + { + // prints "Hello, World!" + System.out.println("Hello, World!"); + } +} +``` +Output: + +```text +Hello, World! +``` +Here, we have used two single-line comments: + +- `"Hello, World!" program example` +- `prints "Hello World!"` + +The Java compiler ignores everything from `//` to the end of line. Hence, it is also known as **End of Line** comment. + +### Multi-line Comment + +When we want to write comments in multiple lines, we can use the multi-line comment. To write multi-line comments, we can use the `/*....*/` symbol. For example, + +```java +/* This is an example of multi-line comment. + * The program prints "Hello, World!" to the standard output. + */ + +class HelloWorld { + public static void main(String[] args) { + { + System.out.println("Hello, World!"); + } +} +``` +Output: + +```text +Hello, World! +``` +Here, we have used the multi-line comment: + +```java +/* This is an example of multi-line comment. +* The program prints "Hello, World!" to the standard output. +*/ +``` +This type of comment is also known as **Traditional Comment**. In this type of comment, the Java compiler ignores everything from `/*` to `*/`. + +## Use Comments the Right Way + +One thing you should always consider that comments shouldn't be the substitute for a way to explain poorly written code in English. You should always write well structured and self explaining code. And, then use comments. + +Some believe that code should be self-describing and comments should be rarely used. However, in my personal opinion, there is nothing wrong with using comments. We can use comments to explain complex algorithms, regex or scenarios where we have to choose one technique among different technique to solve problems. + ++
© {new Date().getFullYear()} Javaistic. All rights reserved.
- +Privacy Policy
From 52b4424a29bf464c1848af08833f179775b12be4 Mon Sep 17 00:00:00 2001 From: Arghya Ghosh <71373838+uiuxarghya@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:50:49 +0530 Subject: [PATCH 35/37] Create open-source-on-github.svg --- src/img/home/open-source-on-github.svg | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/img/home/open-source-on-github.svg diff --git a/src/img/home/open-source-on-github.svg b/src/img/home/open-source-on-github.svg new file mode 100644 index 00000000..ce245d88 --- /dev/null +++ b/src/img/home/open-source-on-github.svg @@ -0,0 +1 @@ + \ No newline at end of file From 40c46a5bffd582b181553f294096b40222649e73 Mon Sep 17 00:00:00 2001 From: Arghya Ghosh <71373838+uiuxarghya@users.noreply.github.com> Date: Sat, 27 Nov 2021 21:50:59 +0530 Subject: [PATCH 36/37] Create OpenSource.js --- src/components/home/OpenSource.js | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/components/home/OpenSource.js diff --git a/src/components/home/OpenSource.js b/src/components/home/OpenSource.js new file mode 100644 index 00000000..7cf4042d --- /dev/null +++ b/src/components/home/OpenSource.js @@ -0,0 +1,46 @@ +import NextLink from 'next/link' +import React from 'react' +import NextImage from 'next/image' + +const GitHubImage = () => { + return ( ++ Join the community and help us build the best open source Java learning site for + everyone. +
+Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: