Skip to content

Commit e8dd576

Browse files
Create welcome to java
1 parent 7896422 commit e8dd576

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

welcome to java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.*;
2+
import java.lang.*;
3+
import java.io.*;
4+
5+
public class Main
6+
{
7+
public static void main (String[] args) throws java.lang.Exception
8+
{
9+
System.out.println("hello world"); // to print on a screen
10+
System.out.print("************");
11+
System.out.println("print in same line ");
12+
// to take inputs from user
13+
Scanner sc = new Scanner(System.in); // here sc is a variable
14+
// data types
15+
int n = sc.nextInt();
16+
long m =sc.nextLong();
17+
char ch = '@';
18+
String s1 =sc.next(); //next encounters both space and enter
19+
String s2 =sc.nextLine();// nextLine encounters only enter for nextline
20+
float a =sc.nextFloat();
21+
double b =sc.nextDouble();
22+
boolean flag =sc.nextBoolean();
23+
short c= sc.nextShort();
24+
//how to concatinate the integers and strings
25+
int p = 400;
26+
int q =200;
27+
System.out.println("sum of two numbers is "+(a+b));
28+
System.out.println("this is concatination "+a+b);
29+
}
30+
}

0 commit comments

Comments
 (0)