導航:首頁 > 編程語言 > java翻譯代碼

java翻譯代碼

發布時間:2023-01-03 14:09:51

『壹』 把java代碼翻譯成易語言

這樣吧給你解釋一下意思

public class Test { //某一個類,可以理解為窗口程序集1,

public static void main(String[] args) { //程序入口,可以理解成_啟動窗口創建完畢
//str為參與校驗的字元串
//檢驗和的概念一般體現在8bit長度的字元數組
//下面使用的字元串全為ASCII碼
String str="GPGGA,075935.000,2435.8682,N"; //命名一個字元串變數,並且賦值,在易語言中即變數1=「GPGGA,075935.000,2435.8682,N」,其中變數1為文本型變數。
//和校驗是異或運算,需要先強制把字元轉換成整形數據
char ch=str.charAt(0);
int x=(int)ch;
int y;
for(int i=1;i<str.length();i++){
y=(int)str.charAt(i);
x=x^y;
}
//x即為校驗和,下面將其轉換成十六進制形式
String check=Integer.toHexString(x);
}
//就是將它後面這一段不好翻譯,就是分割文本(變數1,「,」)然後用循環將它轉換成16進制,在易語言中為十到十六(變數1[i])
}

『貳』 怎麼將Java邏輯代碼翻譯成tsql語句

把java代碼轉成smali代碼共需要以下三個步驟 1、編譯java代碼為class文件 javac smaliTest.java 這個比較簡單,會生成smaliTest.class文件 2、把class文件轉成dex文件 我們知道apk包里java代碼最後生成的是class.dex文件,把class轉化成dex文件

『叄』 java 語句翻譯

1.是循環語句
x的初值是1;
判斷x的值是否小於10,如果不是,退出循環體,如果是輸出x,然後再進行x+1;
然後又判斷x的值是否小於10,如果不是,退出循環體,如果是,輸出x,然後又再進行x+1;
如此循環,直至x的值不再小於10,退出這段循環體.
2.是分支語句
判斷mingCi的值;
如果等於1,執行case 1,輸出"哈哈",然後break,退出分支語句;
如果等於2,執行case 2,執行case 2的命令,然後break,退出分支語句;
……向下查找等於mingCi的值…………
如果沒有等於mingCi的值,最後要執行default語句的命令,退出分支語

句。
希望你可以看懂,最好你自己去找一些基礎的java語法輸來看,狠簡單的。

『肆』 看不懂這些java代碼,求解,翻譯

package ff;

import java.util.Timer;

import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;

//首先聲明一個LoginFrame類並繼承javax.swing.JFrame類(Java裡面Swing的窗體類)。
public class LoginFrame extends javax.swing.JFrame
{
//聲明SplashFrame類的引用splash
private SplashFrame splash = null;
//聲明Timer(計時器)
public static Timer timer = new Timer();
//構造器
public LoginFrame() {
/*
* 該功能實現:在登錄界面運行之前,完成快閃屏的顯示
* 1)顯示快閃屏幕;2)讓快閃屏停留3000毫秒;3)快閃屏消失,登錄窗口顯示;
*/
//如果SplashFrame為空則創建一個
if (splash == null) {
splash = new SplashFrame();
}

// 1)顯示快閃屏幕,調用顯示快閃屏的方法showSplashScreen()
//將run方法裡面的內容嵌入到主線程(UI)裡面執行。此方法不能再主線程里調用,只能在自建線程里調用
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//設置為可見
splash.setVisible(true);
}
});
// 2)讓快閃屏停留3000毫秒
try {
Thread.sleep(3000);//上本線程睡覺3秒
} catch (Exception e) {
e.printStackTrace();
}
// 3)退出快閃屏
//將run方法裡面的內容嵌入到主線程(UI)裡面執行。
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//釋放splash
splash.dispose();
splash = null;
}
});
//設置窗口的圖標
this.setIconImage(new ImageIcon("E:/Java_project/pro_RoomManage/image/system.png").getImage());
//初始化登錄窗口
initComponents();
}

『伍』 Java源代碼翻譯成class

#1 代碼少的話用JDK 里的javac.exe

#2 代碼多的話建議用工具編譯如Eclipse

Over 完畢

『陸』 求大神翻譯一下這段JAVA代碼,明天要給別人逐句講

// 定義一個類,繼承與JFrame窗體類
public class HttpViewer extends JFrame {
//定義文本框
private JTextField urlInput;
//定義文本區域
private JTextArea viewArea;
//程序入口,一切從這里開始運行
public static void main(String[] args) {
//定義HttpViewer對象,對象定義後自動運行對象所屬類的構造函數
new HttpViewer();
}
//類的構造函數
public HttpViewer() {
//定義窗體標題
this.setTitle("Http Viewer");
//定義窗體大小
this.setSize(800, 600);
//能不能調整大小:不行
this.setResizable(false);
//窗體只有關閉按鈕
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
//調用下面的方法
initPanel();
//調用下面的方法
initAction();
//顯示窗體
this.setVisible(true);
}

// 這個方法用來設置窗口布局
private void initPanel() {
//定義一個面板
JPanel northPanel = new JPanel();
//定義一個文本標簽,顯示 的文字URL
JLabel urlInputLabel = new JLabel("URL:");
//前面定義的文本框的大小
urlInput = new JTextField(60);
//把標簽放在面板里
northPanel.add(urlInputLabel);
//把文本框放在面板里
northPanel.add(urlInput);
//把面板放在床體里,位置在北
this.add(northPanel, BorderLayout.NORTH);
//定義另一個面板
JPanel centerPanel = new JPanel();
//定義文本區域
viewArea = new JTextArea(27, 60);
//文本區域放在面板里
centerPanel.add(new JScrollPane(viewArea));
//面板放在窗體里
this.add(centerPanel);
}
/////////// 你給的時間太少了,寫不完剩下的注釋
// 這個方法用來設置事件
private void initAction() {
//為文本框加事件監聽器
urlInput.addActionListener(new ActionListener() {
//每次時間發生後
public void actionPerformed(ActionEvent e) {
//獲取文本框的值
String text = urlInput.getText();
//看看是不是空的
if (text == null || text.length() == 0) {
//空的話文本區域顯示你沒有輸入URL
viewArea.setText("您沒有輸入URL");
//函數退出
return;
}
try {
//定義URL對象,為了訪問網路,他的值就是文本框的網址
URL url = new URL(text);
//調用getContent方法獲取網站的html代碼
String context = getContent(url);
if (context != null) {
//如果獲取的不是空的話,運行searchFromText方法,參數是context
searchFromText(context);
}
//如果發生異常,比如這電腦根本沒網之類的
} catch (MalformedURLException e1) {
//文本區域中現顯示下面的文字
viewArea.setText("您輸入的URL不合法:" + text);
}
}
});
}
//這個方法是要發送網站訪問請求
private String getContent(URL url) {
//定義一個字元流
StringBuffer builder = new StringBuffer();
//定義伺服器狀態代碼變數,200為正常,4xx,5xx,3xx都是錯誤
int responseCode = -1;
//定義http請求類
HttpURLConnection con = null;
try {
//按照獲取的網址鏈接網站
con = (HttpURLConnection) url.openConnection();
//以火狐瀏覽器的方式發送請求。。 模擬windows電腦上的火狐瀏覽器想訪問這個網頁
con.setRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");// IE代理進行下載
//發送連接請求後過1分鍾沒響應的話拉倒
con.setConnectTimeout(60000);
//連接成功後1分鍾都讀不完網站代碼的話拉倒
con.setReadTimeout(60000);

// 獲得網頁返回信息碼(就是前面的狀態)
responseCode = con.getResponseCode();
//如果連接失敗,所以那個-1一直沒變
if (responseCode == -1) {
//連接失敗的話,文本區域顯示下面的文字
viewArea.setText("連接失敗:" + url.toString());
return null;
}
//如果發生錯誤
if (responseCode >= 400) {
//發生錯誤的話,文本區域顯示下面的文字
viewArea.setText("請求失敗,錯誤碼:" + responseCode);
return null;
}
//定義輸入流,把讀出來的網頁代碼保存起來
InputStream is = con.getInputStream();
//輸入流讀出來,放在isr上
InputStreamReader isr = new InputStreamReader(is);
//又把他放在緩存上
BufferedReader br = new BufferedReader(isr);
//定義文本變數
String str = null;
//如果行存在的話
while ((str = br.readLine()) != null)//一行一行的讀,把讀的值給str
//把str上的一行文字加到builder上
builder.append(str);
//輸入流關閉
is.close();
//如果異常,就拋出
} catch (IOException e) {
e.printStackTrace();
//文本區域顯示下面文字
viewArea.setText("IOException: " + url.toString());
} finally {
//無論發生錯誤還是不發生 最終把鏈接關閉
con.disconnect();
}
//返回builder
return builder.toString();
}
//這個方法是用正則表達式從獲取的網頁源碼中找到<a>標簽里的鏈接網址
private void searchFromText(String context) {
viewArea.setText("查找URL中:\n");
Pattern pattern = Pattern.compile("<a( [^>]+)*>(.*?)</a>");
Matcher matcher = pattern.matcher(context);
while (matcher.find()) {
for (String prop : matcher.group(1).split(" ")) {
int indexOf = prop.indexOf('=');
if (indexOf > 0) {
if (prop.substring(0, indexOf).equals("href")) {
String url2 = prop.substring(indexOf + 2, prop.length() - 1);
viewArea.append(url2 + "\n");
}
}
}
}
}

}

『柒』 Java 代碼翻譯

packagecom.lp.test;

publicclassStringTest{
publicstaticvoidmain(String[]args){
//TODOcodeapplicationlogichere
//列印main方法參數
if(args.length>0){
for(inti=0;i<args.length;i++){
System.out.println(args[i]);
}
}else{
System.out.println("Noargs.");
}

Stringstr="12345";
//將str拆分為單個char輸出
for(inti=0;i<str.length();i++){
System.out.print(str.charAt(i)+"");
}
System.out.println("");
//截取str前四位
str=str.substring(0,4);
System.out.println(str);
//將截取後的str與"77777"進行拼接
str=str.concat("77777");
System.out.println(str);
//輸出7在str中第一次出現的位置
intindex=str.indexOf('7');
System.out.println(index);
//獲取7在str中最後一次出現的位置
intlastIndex=str.lastIndexOf('7');
System.out.println(lastIndex);
//將str中的7全部換為6
str=str.replace('7','6');
System.out.println(str);
//將str中第一次出現的"6666"置換為"5"
str=str.replaceAll("6666","5");
System.out.println(str);

//初始化一個包含"12345"的字元串緩沖對象
StringBuilderstrb=newStringBuilder("12345");
//循環輸出字元串緩沖對象的內容
for(inti=0;i<strb.length();i++){
System.out.print(strb.charAt(i)+"");
}
System.out.println("");
//刪除strb中索引為4的字元
strb.deleteCharAt(4);
System.out.println(strb);
//在刪除字元後的strb中拼接"77777"
strb.append("77777");
System.out.println(strb);
//在索引為4芳容位置上插入"56";
strb.insert(4,"56");
System.out.println(strb);
//顛倒strb中的字元順序
strb.reverse();
System.out.println(strb);

Stringhello="HelloWord";
//將hello字元串轉換為全小寫
System.out.println(hello.toLowerCase());
//將hello字元串轉換為全大寫
System.out.println(hello.toUpperCase());

}

}

『捌』 求翻譯解釋一下Java代碼

publicclassTest{
publicstaticStringoutput="";

publicstaticvoidfoo(inti){
try{
if(i==1){
thrownewException();//如果參數為1,拋出異常,進入到catch
}
output+="1";
}catch(Exceptione){
output+="2";//如果參數為1,執行這里
return;
}finally{
output+="3";//不管怎樣這里都要執行
}
output+="4";//這里是最後一個執行語句,拋出異常就不執行這里
}
publicstaticvoidmain(String[]args){
foo(0);//第一次調用
foo(1);//第二次調用
System.out.println(Test.output);
}
}
/*
*現在說下執行步驟:output的值我[]括起來
*第一次調用foo(0):(1)參數為0,所以執行output+="1",那麼output現在為[1];
* (2)執行到output+="3",那麼output現在為[13];
* (3)執行到output+="4";那麼output現在為[134]
*第二次調用foo(1):(1)執行if裡面,拋出異常
* (2)進入到catch,執行output+="2",output現在為[1342]
* (3)進入finally,執行output+="3", output現在為[13423]
*/

閱讀全文

與java翻譯代碼相關的資料

熱點內容
dvd光碟存儲漢子演算法 瀏覽:756
蘋果郵件無法連接伺服器地址 瀏覽:962
phpffmpeg轉碼 瀏覽:671
長沙好玩的解壓項目 瀏覽:142
專屬學情分析報告是什麼app 瀏覽:564
php工程部署 瀏覽:833
android全屏透明 瀏覽:732
阿里雲伺服器已開通怎麼辦 瀏覽:803
光遇為什麼登錄時伺服器已滿 瀏覽:301
PDF分析 瀏覽:484
h3c光纖全工半全工設置命令 瀏覽:141
公司法pdf下載 瀏覽:381
linuxmarkdown 瀏覽:350
華為手機怎麼多選文件夾 瀏覽:683
如何取消命令方塊指令 瀏覽:349
風翼app為什麼進不去了 瀏覽:778
im4java壓縮圖片 瀏覽:362
數據查詢網站源碼 瀏覽:150
伊克塞爾文檔怎麼進行加密 瀏覽:890
app轉賬是什麼 瀏覽:163