Reverse a string in Java
I have "Hello World"
kept in a String variable named hi
.
What is wrong in this code that i have written for a leetcode problem [closed]
Closed 1 hour ago.
What is wrong in this code that i have written for a leetcode problem [closed]
Closed 1 hour ago.
printing a String multiple times by multiplying it by an integer
How do I print a string more than once in Java?
How to reduce the time complexity of my code?
class Solution { static String revStr(String s) { String ans = “”; for(int i = s.length()-1; i >= 0; i–) { ans += s.charAt(i); } return ans; } } I was solving a question to reverse a string and my output was correct, but it was taking longer than expected, and I can’t figure out […]
Java Program to reverse the two number and find its sum
This Java Program we Reverse two Number and find the Sum of its Digits Using while Loop.While loop checks the condition first and then executes the statement here first we find the reminder and then Multiply reverse number by 10 and add remainder of number.Dividing number by 10 to access digit position.after that we sum the both reverse number.
Javatechnote.com
Who is responsible for instantiating the String object in Java?
We know that it is possible to pass values through the constructors of an object, see this example: