国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

我的java學習筆記version0.1

2019-11-18 13:42:10
字體:
來源:轉載
供稿:網友
 

關于java語言程序的問題
1、對于java應用程序來說,static靜態變量和方法的含義。
import java.io.*;
public class Iamxiao
{

  static String st1="中國將收復臺灣!";
/*此處必須定義為靜態,否則系統會提示在main主程序中找不到st1變量。
  定義為public也不行,這是為什么呀?
 
*/
  public static void main(String args[])
    {
 
     Iamxiao2 Iamxiao1;
     Iamxiao1=new Iamxiao2();
     System.out.   
     }
}
以下再寫一個應用程序進行實驗,此程序依舊運行時報錯。
class _beidy
{
 String st1="中國將收復臺灣!";
 System.out.println("Hello the world!"+st1);
}
public class _diaoyz
{
 public static void main(String args[])
   {
    _beidy _newobj=new _beidy();
    }

}

以下再寫成小應用程序進行實驗。

class _beidy
{
/*總算明白了,這正是java語言要求的封裝性。
*/
 public void _beidyp()
 {
  String st1="中國將收復臺灣!";
  System.out.println("Hello the world!"+st1);
 }
}
public class _diaoyz
{
 public static void main(String args[])
   {
    _beidy _newobj=new _beidy();
    _newobj._beidyp();
    }

}
以下再進行測試。
class _beidy
{
 String st1="中國將收復臺灣!";
 
 //System.out.println("Hello the world!"+st1);
}
public class _diaoyz
{
 public static void main(String args[])
   {
    _beidy _newobj=new _beidy();
    System.out.println("Hello the world!"+_newobj.st1);
/*通過成員函數進行類的實例對象的調用。輸出語句不能直接放
到一個類的定義下嗎?

*/
    }

}


2、以下示例讓我們了解類名的定義,須定義為$,_,字母開頭的字符串,其長度沒有限制,
也就是受限于你的
操作系統文件名的長度。文件確實可以超長,已做實驗。


import java.io.*;
public class $Sta1
{

  static String st1="我是肖大靳!"; //此處必須定義為靜態。
 
  public static void main(String args[])
    {
 
     $Sta1 sta1_o;
     sta1_o=new $Sta1();
     System.out.println("Hello the world!"+st1);
   
     }
}

/*文件超長的例子。類名絕對不能超長,windows98下為235個字符長。
  以下所定義的類名為最長,多加一個2即會報錯。
*/
class _beidy1212121212121212121212121212122323434433245234524534523452452452452452452452452524524245245245245245245245424242452424242424524524245245245245245243524524524524352345243524245242424234524352432222222222222222222222222222222222222
{
 public void init()
 {
  String st1="中國將收復臺灣!";
  System.out.println("Hello the world!"+st1);
 }
}
public class _diaoyz
{
 public static void main(String args[])
   {
   // _beidy _newobj=new _beidy();
   // System.out.println("Hello the world!"+_newobj.st1);
   //_newobj.init();
   _beidy1212121212121212121212121212122323434433245234524534523452452452452452452452452524524245245245245245245245424242452424242424524524245245245245245243524524524524352345243524245242424234524352432222222222222222222222222222222222222 _newobj=new _beidy1212121212121212121212121212122323434433245234524534523452452452452452452452452524524245245245245245245245424242452424242424524524245245245245245243524524524524352345243524245242424234524352432222222222222222222222222222222222222();
   _newobj.init();
    }



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 京山县| 上林县| 沙坪坝区| 兰溪市| 通州区| 旌德县| 玉门市| 怀柔区| 巴塘县| 明溪县| 武鸣县| 舟山市| 玛多县| 长葛市| 屏边| 沭阳县| 宣威市| 友谊县| 东兴市| 威宁| 扬中市| 红原县| 手游| 公主岭市| 嘉兴市| 繁峙县| 宁河县| 明星| 邯郸市| 祁阳县| 九江市| 墨脱县| 修武县| 宽甸| 紫金县| 台中县| 房产| 惠安县| 通许县| 花莲市| 比如县|