如何从文本文件中创建一个方法? [英] How to create a method out of the text file?

查看:163
本文介绍了如何从文本文件中创建一个方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含Java代码的文本( .txt )!我想创建一个包含这个Java代码的方法,然后通过程序调用该方法。

I have a text (.txt) file that contains Java code! I want to create a method that includes this Java code and then call that method through the program.

任何人都可以建议这样做吗?

Can anybody suggest a way to do this?

推荐答案

let请考虑此示例它实际加载源代码,编译和执行java代码通过简单的程序通过使用JavaCompiler API。

let consider this example what it does actually load the source code, compile and execute the java code by simpler program by using JavaCompiler API.

这篇关于如何从文本文件中创建一个方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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