freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

最新面向?qū)ο蟪绦蛟O(shè)計(jì)-資料下載頁(yè)

2025-07-07 14:45本頁(yè)面
  

【正文】 60。 sum += j。 if (i+j 6) continue inner。 } } (sum= + sum)。 } }參考答案:答:sum=27 5下面程序的執(zhí)行結(jié)果是什么?class SuperClass { void method() { (SuperClass::method)。 } void fun() { (SuperClass::fun)。 ()。 }}class SubClass extends SuperClass { void method() { (SubClass::method: Begin)。 ()。 (SubClass::method: End)。 }}class Test { public static void main(String[] args) { SubClass a = new SubClass()。 ()。 }}參考答案:答:會(huì)陷入死循環(huán),直到棧溢出報(bào)錯(cuò)!SubClass::method: BeginSuperClass::fun 5下面的程序錯(cuò)在哪里?如何修改?class SuperClass {}class SubClass extends SuperClass {}class Test { public static void main(String[] args) { SuperClass a = new SuperClass()。 SubClass b = new SubClass()。 b = (SubClass)a。 } }參考答案:答:b = (SubClass)a。這一句無(wú)法通過(guò)編譯。報(bào)錯(cuò)信息為:Exception in thread main : SuperClass cannot be cast to SubClass原因在于向下轉(zhuǎn)型(downcasting)是有前提的。改正:將SuperClass a = new SuperClass()。改為SuperClass a = new SubClass()。就可以了。 5下列語(yǔ)句序列給出了k,myArr和myMethod()的聲明。當(dāng)調(diào)用方法myMethod(myArr, k)之后,存儲(chǔ)在myArr和k里的值分別是什么?int k = 7。String myArr[] = {“l(fā)ove”,“peace”,”and”}。void myMethod(String a[], int m) { String temp = a[1]。 a[1] = a[2]。 a[2] = temp。 m = a[2].length()。}參考答案:答:myArr中的值是{“l(fā)ove”,“and”,”peace”}k的值是75閱讀下面程序,并回答問(wèn)題。(1)類Child和類Parent之間是什么關(guān)系?(2)關(guān)鍵字super和this分別是什么含義?(3)這段程序的輸出是什么?class Parent{ public void printMe( ){ (parent)。 }}class Child extends Parent{ public void printMe( ){ (child)。 } public void printAll( ){ ( )。 ( )。 }}public class Test3{ public static void main(String args[ ]){ Child myC = new Child( )。 ( )。 }}br span= style=boxsizing: borderbox。/br參考答案:?jiǎn)栴}(1):Child是Parent的子類(或Parent是Child的父類,或繼承關(guān)系)。問(wèn)題(2):super指對(duì)象的父類(或超類)。this指使用它的對(duì)象本身(或?qū)?duì)象自己的引用)。問(wèn)題(3):程序的輸出是: parent child5閱讀下面的程序,寫(xiě)出程序運(yùn)行的輸出結(jié)果。public class Test1 { public int method(int n) { int result = 1。 for (int i=1。 i=n。 i++) { result *= i。 } return result。 } public static void main(String args[]{ Test1 test = new Test1( )。 int sum[] = new int[6]。 for (int i=1。 i=5。 i++) { sum[i] = (i) 。 (sum[i] + )。 } }}參考答案:答:程序運(yùn)行的輸出結(jié)果是:1 2 6 24 120 60、寫(xiě)一個(gè)Java Application。讓用戶在文本框中輸入一個(gè)字符串,程序會(huì)將其中的大寫(xiě)字母變?yōu)樾?xiě)字母,小寫(xiě)字母為變大寫(xiě)字母(其余字符不變),并按照逆序?qū)⑺鼈冿@示在一個(gè)文本域中。(例如:用戶輸入“abc123XYZ”,點(diǎn)擊按鈕或按下回車,程序會(huì)輸出“zyx321CBA”)參考答案:// import語(yǔ)句import .*。 import .*。import .*。public class StringConvert extends JFrame implements ActionListener{ // 組件聲明及創(chuàng)建 private JTextField input = new JTextField(15)。 private JButton convert = new JButton( 大小 + 逆序 )。 private JTextField display = new JTextField(15)。 // 添加組件 public StringConvert () { Container c = getContentPane()。 (new FlowLayout())。 (input)。 (convert)。 (display)。 (this)。 } // 處理按鈕動(dòng)作事件 public void actionPerformed(ActionEvent e) { (convert(()) + \n)。 } // 實(shí)現(xiàn)逆序 public String convert(String str) { StringBuffer resultStr = new StringBuffer()。 char ch。 for (int i = () 1。 i = 0。 i) { ch = (i)。 if ((ch = 39。A39。) amp。amp。 (ch = 39。Z39。)) ((char) (ch + 32))。 // 實(shí)現(xiàn)大寫(xiě)字母變小寫(xiě)字母 else if ((ch = 39。a39。) amp。amp。 (ch = 39。z39。)) ((char) (ch 32))。 // 實(shí)現(xiàn)小寫(xiě)字母變大寫(xiě)字母 else (ch)。 } return ()。 } // 設(shè)置框架屬性 public static void main(String args[]) { StringConvert f = new StringConvert()。 ()。 (640, 160)。 (true)。 }}
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1