Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55a084b

Browse files
Add files via upload
1 parent c0b5d39 commit 55a084b

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

‎Add Two Numbers.java‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class add{
2+
3+
public static void main(String[] args) {
4+
5+
int first = 10;
6+
int second = 20;
7+
8+
int sum = first + second;
9+
10+
System.out.println("The sum is: " + sum);
11+
}
12+
}

‎Float To Integer .java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public class change {
2+
public static void main (String[] args) {
3+
double myvar=2.4;
4+
int myvar2=8;
5+
6+
7+
myvar2 = myvar;
8+
System.out.println(myvar);
9+
}
10+
}

‎TypesAndVariable.java‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class TypesAndVariable {
2+
public static void main (String[] args) {
3+
int MyVariable; // Declaring a varibale called MyVariable that store type int, integers
4+
MyVariable = 5; //This is MyVariable
5+
6+
System.out.println(MyVariable);
7+
8+
MyVariable = 10; //Here we changed MyVariable. So it means we can only store one integer
9+
10+
System.out.println(MyVariable);
11+
12+
MyVariable = MyVariable + 2; //Now we are adding +2 in Changed variable
13+
14+
System.out.println(MyVariable);
15+
}
16+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /