Categories
java

Print a String in java with example

Print a String in java

In this tutorial, we will learn to print a String in java with example


Syntax

System.out.println("");

Example

public class PrintExample {

  public static void main(String[] args) {
    String printingText = "Hello World";
    // Below line will print above string variable
    System.out.println(printingText);
  }
}

Output

Hello World

Reference

https://docs.oracle.com/javase/tutorial/getStarted/application/index.html

Download

https://github.com/rkumar9090/BeginnersBug/blob/master/BegineersBug/src/com/geeks/example/PrintExample.java

Categories
java

Helloworld in java

Helloworld in java

In this example we will learn how to print helloworld
Helloworld is the first program in all language by programmers

Prerequisites

  • JDK
  • Eclipse

Example

public class HelloWorld {

	public static void main(String[] args) {
		System.out.println("Helloworld");
	}

}

Output

Helloworld

In above example we printed Helloworld using java
Since Java is a OOPS programming language, so here we bounded all the coding inside class and method

class,main is a keyword in java
System.out.println is used to print a string like printf in c++ language

Download

https://github.com/rkumar9090/BeginnersBug/blob/master/BegineersBug/src/com/geeks/example/HelloWorld.java