Skip to content

Commit 81dd134

Browse files
Add files via upload
1 parent 7e87aea commit 81dd134

35 files changed

+671
-0
lines changed

App.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class App {
2+
public static void main(String[] args) throws Exception {
3+
System.out.println("Hello, World!");
4+
}
5+
}

Circle.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
public class Circle {
3+
4+
public String calculatearea;
5+
6+
public String calculatearea() {
7+
return null;
8+
}
9+
10+
public void draw() {
11+
}
12+
13+
}

Final.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
public class Final {
2+
public int x, y, z;
3+
4+
public void methodOne() {
5+
x += 4;
6+
++y;
7+
System.out.println(x);
8+
System.out.println(y);
9+
}
10+
11+
public void methodTwo() {
12+
x += y;
13+
y = x - 6;
14+
System.out.println(y);
15+
}
16+
17+
public void methodThree() {
18+
z += y;
19+
y = z - 6;
20+
x = z - y;
21+
System.out.println(z);
22+
System.out.println(x);
23+
System.out.println(y);
24+
}
25+
public static void main(String[] args) {
26+
Final p = new Final();
27+
p.x = 44;
28+
p.methodOne();
29+
p.y = 3;
30+
p.methodOne();
31+
p.methodOne();
32+
p.methodTwo();
33+
p.methodTwo();
34+
p.z = 10;
35+
p.methodThree();
36+
p.methodThree();
37+
}
38+
}

v1.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class v1 {
2+
public static void main(String[] args) {
3+
System.out.println("Iam Sabbir Hasanat & this is my first code");
4+
}
5+
}

v10_1_Linear_Search.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
3+
public class v10_1_Linear_Search {
4+
public static void main(String[] args) {
5+
6+
Scanner sc = new Scanner(System.in);
7+
8+
System.out.print("Enter size: ");
9+
int n = sc.nextInt();
10+
11+
System.out.print("Enter elements: ");
12+
int a[] = new int[100];
13+
14+
int i,n1;
15+
for(i=0;i<n;i++){
16+
a[i] = sc.nextInt();
17+
}
18+
19+
System.out.print("Enter Searching elements: " + "\n");
20+
n1=sc.nextInt();
21+
22+
for(i=0;i<n;i++){
23+
if(a[i]==n1){
24+
System.out.println(n1+" found at "+ (i+1) );
25+
break;
26+
}
27+
}
28+
if(i==n) System.out.println("Not found");
29+
}
30+
}

v10_1__binary_search.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.util.Scanner;
2+
3+
public class v10_1__binary_search {
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
System.out.print("Enter size: ");
7+
int n = sc.nextInt();
8+
9+
int number[] = new int[n];
10+
11+
System.out.println("Enter elements: ");
12+
for(int i=0;i<n;i++){
13+
number[i] = sc.nextInt();
14+
}
15+
16+
System.out.print("Enter searching elements: ");
17+
int x = sc.nextInt();
18+
19+
for(int i=0;i<n;i++){
20+
if(number[i] == x){
21+
System.out.println("x found at index: "+ (i+1));
22+
}
23+
}
24+
}
25+
}

v10__array.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.Scanner;
2+
3+
public class v10__array{
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
System.out.print("Enter size: ");
7+
int size = sc.nextInt();
8+
int number[] = new int[size];
9+
10+
System.out.print("Enter elements: ");
11+
for(int i=0; i<size; i++){
12+
number[i] = sc.nextInt();
13+
}
14+
15+
System.out.print("printing elements: ");
16+
for(int i=0;i<size;i++){
17+
System.out.print(number[i]+" ");
18+
}
19+
}
20+
}

v10_array.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import java.util.*;
2+
3+
public class v10_array {
4+
public static void main(String[] args) {
5+
6+
//standard style
7+
Scanner sc = new Scanner(System.in);
8+
System.out.print("Enter size: ");
9+
int size = sc.nextInt();
10+
System.out.print("Enter elements: ");
11+
int numbers[] = new int[size];
12+
13+
int i;
14+
15+
//input
16+
for(i=0;i<size;i++){
17+
numbers[i] = sc.nextInt();
18+
}
19+
20+
//output
21+
for(i =0;i<size;i++){
22+
System.out.print(numbers[i]+" ");
23+
}
24+
25+
/* //1st style
26+
//int[] marks = new int[3]; // *1st style
27+
28+
int marks[] = new int[3]; // *2nd style
29+
30+
marks[0]= 97;
31+
marks[1]= 98;
32+
marks[2]= 99;
33+
34+
System.out.println("Physics= "+marks[0]);
35+
System.out.println("Chemistry= "+marks[1]);
36+
System.out.println("Math= "+marks[2]);
37+
*/
38+
39+
/*//2nd style
40+
int marks[]={97,98,99}*/
41+
42+
43+
44+
}
45+
}

v11_1.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import java.util.Scanner;
2+
3+
public class v11_1 {
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
System.out.print("Enter rows: ");
7+
int rows = sc.nextInt();
8+
System.out.print("Enter cols: ");
9+
int cols = sc.nextInt();
10+
11+
int numbers[][] = new int[rows][cols];
12+
13+
//input
14+
System.out.println("Enter elements: ");
15+
for(int i=0; i<rows; i++){
16+
for(int j=0; j<cols; j++){
17+
numbers[i][j] = sc.nextInt();
18+
}
19+
}
20+
21+
System.out.print("Enter found elements: ");
22+
int x = sc.nextInt();
23+
24+
25+
for(int i=0; i<rows; i++){
26+
for(int j=0; j<cols; j++){
27+
if(numbers[i][j] == x){
28+
System.out.println("x found at location ("+i+","+j+")");
29+
}
30+
}
31+
System.out.println();
32+
}
33+
}
34+
}

v11__2d_array.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
3+
public class v11__2d_array {
4+
public static void main(String[] args) {
5+
Scanner sc = new Scanner(System.in);
6+
int rows = sc.nextInt();
7+
int cols = sc.nextInt();
8+
9+
int numbers[][] = new int[rows][cols];
10+
11+
for(int i=0; i<rows; i++){
12+
for(int j=0; j<cols; j++){
13+
numbers[i][j] = sc.nextInt();
14+
}
15+
}
16+
17+
18+
//output
19+
for(int i=0; i<rows; i++){
20+
for(int j=0; j<cols; j++){
21+
System.out.print(numbers[i][j]+" ");
22+
}
23+
System.out.println();
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)