Skip to content

Commit 8084b0b

Browse files
Naveen KhuntetaNaveen Khunteta
authored andcommitted
Data types and String concatenation
0 parents  commit 8084b0b

File tree

7 files changed

+134
-0
lines changed

7 files changed

+134
-0
lines changed

.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>MorningJavaSessions</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8

bin/JavaSessions/DataTypes.class

1.51 KB
Binary file not shown.
1.61 KB
Binary file not shown.

src/JavaSessions/DataTypes.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package JavaSessions;
2+
3+
public class DataTypes {
4+
//8:30 AM IST
5+
//this is my first java code
6+
/*this is my java code
7+
and I'm so happy
8+
data types concept*/
9+
public static void main(String[] args) {
10+
11+
//Primitive Data types: int, double, boolean, char
12+
//Non Primitive Data Types: String, Array
13+
//1. int (4 bytes): byte (1byte), long(8 bytes), short(2 bytes)
14+
int i = 10;
15+
i = 20;
16+
int i1 = 20;
17+
int j = 100;
18+
int k = -10;
19+
int p = 0;
20+
int age = 25;
21+
System.out.println(i);
22+
System.out.println(age);
23+
System.out.println(i+j);
24+
25+
//2. double (8bytes), float(4 bytes)
26+
double d1 = 12.33;
27+
double d2 = -12.33;
28+
double d3 = 100; //100.00
29+
System.out.println(d1);
30+
31+
//3. char:
32+
char c1 = 'a';
33+
char c2 = '$';
34+
char c3 = '1';
35+
char gender = 'M';
36+
37+
//4. boolean:
38+
boolean b1 = true;
39+
boolean b2 = false;
40+
41+
//String: is a class in java
42+
String s1 = "Hello World";
43+
String s2 = "Selenium";
44+
String s3 = "Hi this is my java code";
45+
String s4 = "1000";
46+
String s5 = "12.33";
47+
48+
System.out.println(s1);
49+
System.out.println(s4);
50+
System.out.println(100);
51+
System.out.println("Hello Testing");
52+
System.out.println(s1+s2);
53+
54+
55+
}
56+
57+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package JavaSessions;
2+
3+
public class StringConcatenation {
4+
5+
public static void main(String[] args) {
6+
7+
int a = 100;
8+
int b = 200;
9+
String x = "Hello";
10+
String y = "World";
11+
12+
System.out.println("the sum of a and b is:"+(a+b));
13+
14+
System.out.println(a+b);
15+
System.out.println(x+y);
16+
System.out.println(a+b+x+y);//error, 300HelloWorld, 300HelloWorld,
17+
//300HelloWorld, 300HelloWorld, 300HelloWorld, 300HelloWorld
18+
System.out.println(x+y+a+b);
19+
//HelloWorld300, HelloWorld100200, HelloWorld300,
20+
//HelloWorld100200, HelloWorld300, HelloWorld100200,
21+
//HelloWorld300
22+
System.out.println(x+y+(a+b));
23+
//HelloWorld100200,HelloWorld300,HelloWorld300,
24+
//HelloWorld300, HelloWorld300, HelloWorld300,
25+
//HelloWorld300
26+
27+
double d1 = 12.33;
28+
double d2 = 10.33;
29+
System.out.println(x+y+d1+d2);
30+
System.out.println(d1+d2+x+y);
31+
32+
int i = 10;
33+
System.out.println("the value of i is:" + i );
34+
35+
long id = 12345;
36+
System.out.println("your transaction id is "+ id);
37+
38+
39+
40+
41+
}
42+
43+
}

0 commit comments

Comments
 (0)