DEV Community

Janardhan Pulivarthi
Janardhan Pulivarthi

Posted on • Updated on

Day 14 of 100 - Java: basic examples and Java RMI example

Journal note: 📝
I have started asking for referrals for a programming job, from my friends. And also actively applying for jobs. :)

Check for Palindrome

String

String str = "rar", reverseStr = "";

int strLength = str.length();
for(int i=(length-1); i > 0; i--) {
  reverseStr = reverseStr + str.CharAt(i);
}

if (str.equals(reverseStr))
  System.out.print("The string is Palindrome");
Enter fullscreen mode Exit fullscreen mode

Number

int num = 1001, reverseNum = 0;

if (num != 0) {
  reverseNum = num%10 + reverseNum * 10;
  num  = num / 10;
}

Enter fullscreen mode Exit fullscreen mode

Transpose of a matrix

int row=2, column=3;
int[][] matrix = {{1,2,3}, {4,5,6}};

int[][] transpose = new int[column][row];
for (int i=0; i < row; i++) {
  for (int j=0; j < column; j++) {
    transpose[j][i] = matrix[i][j];
  } 
}
Enter fullscreen mode Exit fullscreen mode

Java RMI

https://github.com/j143/java-rmi-example

Top comments (0)