国产探花免费观看_亚洲丰满少妇自慰呻吟_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();
    }



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 喀什市| 海晏县| 镶黄旗| 迭部县| 犍为县| 兴业县| 岐山县| 苏州市| 西昌市| 湘乡市| 株洲市| 津市市| 溆浦县| 琼海市| 临泉县| 巧家县| 凤阳县| 绥江县| 象州县| 临武县| 彭州市| 渭南市| 阿克苏市| 桐乡市| 博兴县| 甘孜县| 江门市| 垣曲县| 贵州省| 象州县| 环江| 乌拉特后旗| 内丘县| 咸丰县| 修文县| 峨眉山市| 水富县| 正阳县| 宜城市| 定结县| 涪陵区|