-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtdarray.java
More file actions
47 lines (45 loc) · 1.48 KB
/
tdarray.java
File metadata and controls
47 lines (45 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
public class tdarray {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int rows=sc.nextInt();
int colm=sc.nextInt();
int array[][]= new int [rows][colm];
for (int i=0;i<rows;i++){
for (int j=0; j<colm;j++){
array[i][j]=sc.nextInt();
}
}
for (int i=0;i<rows;i++){
for (int j=0; j<colm;j++){
System.out.print(array[i][j] +" ");
}
System.out.println(" ");
}
int x=sc.nextInt();
for (int i=0;i<rows;i++){
for (int j=0; j<colm;j++){
if (array[i][j]==x){
System.out.println("index of x is:"+array[i][j]);
System.out.println("the index is("+i+","+j+")");
}
}
}
//strings
String firstname="mrinal";
String Lastname="more";
String Fullname=firstname+Lastname;
System.out.println(Fullname);
System.out.println(Fullname.length());
for(int i=0; i<=Fullname.length(); i++){
System.out.println(Fullname.charAt(i));
}
/*String name1="tony";
String name2="tony";
if (name1.compareTo(name2) == 0){
System.out.println("String is equal");
}else{
System.out.println("string are not equal");
}*/
}
}