java倒序問題

可以啊

❷ Java倒過來的乘法表

第二個for循環是
for (int b=a;b<=a&&b>=1;b--)

完整代碼
public class GXG {
public static void main(String[]args){
System.out.println("反復乘法表");
for(int a=9;a>=1;a--){
for (int b=a;b<=a&&b>=1;b--){
System.out.print(a+"*"+b+"="+a*b+" ");
}
System.out.println();
}
}
}

❸ Java怎麼倒序string類型的

public static void main(String[] args){
String aa="hdskjfdi";
String bb="";
for(int i=aa.length()-1;i>=0;i--){
bb=bb+aa.charAt(i);
}
System.out.println(bb);
} 其實《此人已掛失》的方法是最簡單的,直接調用的方法,我這個是笨一點的方法,可以幫你理解一下過程

❹ java中倒序用的函數是哪個

StrReverse函數
描述
返回一個字元串,其中一個指定子字元串的字元順序是反向的。
語法
StrReverse(string1)
這個是
string
倒序輸出

❺ JAVA文件倒序輸出

byte[] d=new byte[1];
你給的長度、
你看看這里讀了幾個長度啊?
假設c=5,5個位元組
x1.read(d,c-1, 1); c-1的話就是4了啊。所以報錯撒、、

好像把1文件內容,反著寫到2文件 這個方法不行。具體怎麼做我也不知道

❻ Java倒序輸出數字

import java.util.Scanner;

public class test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
char[] ch = null;
System.out.println("請輸入一個十位數的數字");
String str = sc.next();
if (str.trim().length() != 10) {
System.out.println("你輸入的數字格式不正確,清檢查後重新輸入");
}else {
ch = str.toCharArray();
}
for (int i = ch.length; i > 0 ; i--) {
System.out.print(ch[i-1]);
}
}
}

❼ 關於Java中輸入倒直角三角形的問題

public static void main(String[] args) {
// TODO Auto-generated method stub
int rows = 0;
System.out.print("請輸入直角三角形的行數:");
Scanner input = new Scanner(System.in);
rows = input.nextInt();
for (int i = 0; i <= rows; i++) {
for (int j = 1; j <= rows + 1 - i; j++) {
System.out.print("*");
}
System.out.println("\n");
}
}
i代表的是第幾行,外層循環確定行數,內層循環輸出每一行的*,j表示*的個數,所以j <= rows + 1 - i,i增加,每行的*的個數就會減少,所以呈現倒三角形。另外語句應為System.out.print("*");

❽ 如何用java編寫倒著的九九乘法表

這個你具體有哪些問題了?兩個for循環就行了