Java:是否支持宏? [英] Java: Is there support for macros?

查看:393
本文介绍了Java:是否支持宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇人们如何解决这个问题。我经常写相同类型的代码。例如:

I am just curious on how people solve this. I often write the same type of code all the time. For instance:

new Thread() {
   //...
   //...
   //...
   //Change this line
   //...
   //...
}.start();

我不断更改更改此行的行,然后启动一个主题。此更改可以是一行或几行。我将如何压缩此代码?

I keep changing the line where it says "Change this line" and then starting a thread. This change can be one line or a few lines. How would I go about compacting this code?

推荐答案

好吧,我想你可以通过C预处理器运行你的java文件。 。

Well, I guess you could run your java files through the C preprocessor...

这篇关于Java:是否支持宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆