相关疑难解决方法(0)

如何在Java中循环使用Class属性?

如何动态循环遍历java中的类属性.

例如:

public class MyClass{
    private type1 att1;
    private type2 att2;
    ...

    public void function(){
        for(var in MyClass.Attributes){
            System.out.println(var.class);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这在Java中可能吗?

java attributes loops

76
推荐指数
5
解决办法
16万
查看次数

Java相当于Python repr()?

有没有像Python的repr一样工作的Java方法?例如,假设该函数名为repr,

"foo\n\tbar".repr()
Run Code Online (Sandbox Code Playgroud)

会回来的

"foo\n\tbar"

foo
        bar

至于toString.

python java repr

23
推荐指数
4
解决办法
5433
查看次数

标签 统计

java ×2

attributes ×1

loops ×1

python ×1

repr ×1