java vector_Java Vector elements()方法與示例

java vector

向量類elements()方法 (Vector Class elements() method)

  • elements() method is available in java.util package.

    elements()方法在java.util包中可用。

  • elements() method is used to get an enumeration of the elements that exist in this Vector.

    elements()方法用于獲取此Vector中存在的元素的枚舉。

  • elements() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    elements()方法是一種非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。

  • elements() method does not throw an exception at the time of returning elements in an Enumeration view.

    在枚舉視圖中返回元素時, elements()方法不會引發異常。

Syntax:

句法:

    public Enumeration elements();

Parameter(s):

參數:

  • It does not accept any parameter.

    它不接受任何參數。

Return value:

返回值:

The return type of the method is Enumeration, it returns an Enumeration that contain all objects of this Vector.

該方法的返回類型為Enumeration ,它返回一個Enumeration,其中包含此Vector的所有對象。

Example:

例:

// Java program to demonstrate the example 
// of Enumeration elements() method 
// of Vector 
import java.util.*;
public class ElementsOfVector {
public static void main(String[] args) {
// Instantiates a Vector object  with
// initial capacity of "10"
Vector < String > v = new Vector < String > (10);
// By using add() method is to add the
// elements in this v
v.add("C");
v.add("C++");
v.add("JAVA");
// Display Vector
System.out.println("v: " + v);
// By using elements() method is to
// get all the elements into an Enumeration
// and display it with the help of for loop
System.out.println("Enumeration: ");
for (Enumeration en = v.elements(); en.hasMoreElements();)
System.out.println(en.nextElement());
}
}

Output

輸出量

v: [C, C++, JAVA]
Enumeration: 
C
C++
JAVA

翻譯自: https://www.includehelp.com/java/vector-elements-method-with-example.aspx

java vector

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/378231.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378231.shtml
英文地址,請注明出處:http://en.pswp.cn/news/378231.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【數據結構基礎筆記】【鏈表】

代碼參考《妙趣橫生的算法.C語言實現》 文章目錄前言1、鏈表基礎2、創建一個鏈表3、插入結點4、刪除結點5、銷毀鏈表6、實例分析前言 本章總結&#xff1a;鏈表的定義、創建、銷毀&#xff0c;結點的插入與刪除 1、鏈表基礎 鏈表的物理存儲結構是用一組地址任意的存儲單元存儲…

動態添加,刪除行之心理測試系統

動態添加&#xff0c;刪除行之考試系統 數據庫設計&#xff1a; xl_option 題目選項 20090105134755404(編號) 20090105134904421(外鍵) 比較符合(選項內容) ②(選項標號) 2&#xff08;選項分值&#xff09; xl_subject 題目信息 20090105134943608&#xff08;編號&#xff…

android bitmap裁剪中間,Android裁剪中心位圖

雖然上面的大多數答案提供了一種方法來實現這一點&#xff0c;但已經有一種內置的方法來實現這一點&#xff0c;它是一行代碼(ThumbnailUtils.extractThumbnail())int dimension getSquareCropDimensionForBitmap(bitmap);bitmap ThumbnailUtils.extractThumbnail(bitmap, di…

二、request請求庫

一、requests介紹與安裝 1&#xff0c;requests介紹 答&#xff1a;requests是一個優雅且簡單的Python HTTP請求庫 2&#xff0c;requests作用 答&#xff1a;requests的作用是發送請求獲取響應數據 3&#xff0c;requests安裝 答&#xff1a;pip install requests 二、…

Java Vector Capacity()方法與示例

向量類的Capacity()方法 (Vector Class capacity() method) capacity() method is available in java.util package. Capacity()方法在java.util包中可用。 capacity() method is used to return the current capacity (i.e. initially, how many object exists) of this Vecto…

MFC和GTK的區別

關鍵技術 http://blog.csdn.net/master_max/article/details/1540204 MFC和GTK的區別&#xff1f;&#xff1f; 1.  兩者都是基于面向對象設計的。盡管MFC是用C寫的&#xff0c;而GTK是用C寫的&#xff0c;但思想都是面向對象的。GTK使用glib的對象機制&#xff0c;由于用C寫…

視頻圖像質量評價

目錄1、人眼視覺特性1、眼的適應性2、對比靈敏度3、空間分辨率和時間分辨率4、馬赫效應5、可見度閾值2、圖像質量測度3、圖像評價方法4、圖像評價方法的優劣1、人眼視覺特性 1、眼的適應性 暗適應性&#xff1a;從亮環境到暗環境&#xff0c;適應暗環境的特性 亮適應性&#…

鴻蒙科技與文化,數字閱讀 | “華為鴻蒙”:當現代科技遇到古典文化

華為事件愈演愈烈。海思芯片 20 年 " 備胎 " 終轉正&#xff0c;那么操作系統呢&#xff1f;最近&#xff0c;華為為自主研發的操作系統注冊商標—— " 鴻蒙 "&#xff0c;引發了關于華為注冊整本《山海經》的熱烈討論&#xff0c;很多人的朋友圈&#xff…

三、Beautiful Soup解析庫

一、Beautiful Soup介紹與安裝 1&#xff0c;Beautiful Soup介紹 答&#xff1a;Beautiful Soup是一個可以從HTML或XML文件中提取數據的Python庫 2&#xff0c;Beautiful Soup安裝 答&#xff1a;安裝Beautiful Soup 4&#xff1a;pip install bs4 安裝lxml&#xff1a;pip…

strictmath_Java StrictMath sqrt()方法與示例

strictmathStrictMath類sqrt()方法 (StrictMath Class sqrt() method) sqrt() Method is available in java.lang package. sqrt()方法在java.lang包中可用。 sqrt() Method is used to find the square root of the given parameter in the method. Here, "sqrt" st…

recovery編譯問題匯總

1、修改支持USB大容量存儲 &#xff08;1&#xff09;、首先需要查看手機lun位置 手機鏈接電腦&#xff0c;打開cmd命令行&#xff0c;依次輸入以下命令: adb shell find /sys -name "lun" 輸出以下結果&#xff1a; 發現手機輸出結果有兩個&#xff0c;需要進一步查…

言語理解每日學習及精解20110831

【例題】天氣預報一般要考慮氣溫、氣壓、溫度、風力等因素&#xff0c;這些都是大氣層本身變化的結果&#xff0c;只要掌握這些因素&#xff0c;通過計算機的計算就能準確地預報天氣變化的趨勢。沙塵暴作為一種特殊的天氣現象&#xff0c;同樣要考慮上述氣象因素。據氣象學家分…

【數據結構基礎筆記】【棧】

代碼參考《妙趣橫生的算法.C語言實現》 文章目錄前言1、棧的定義2、創建一個棧3、入棧和出棧操作4、棧的清空、銷毀、計算棧的當前容量5、實例分析前言 本章總結&#xff1a;棧的定義、創建棧&#xff0c;銷毀棧&#xff0c;入棧出棧操作等操作。 1、棧的定義 棧是一種重要的…

四、正則表達式

一、正則表達式的概念和作用 正則表達式概念&#xff1a;一種字符串匹配的模式 正則表達式作用&#xff1a; 可以檢查一個字符串中是否包含某種字串替換匹配的字串提取某個字符串中匹配的字串 二、正則表達式中常見的語法 字符描述原樣字符匹配字符一般字符匹配自身beyondb…

用HTML語言制作list標記,html5 datalist標簽的用法是什么?這里有datalist標簽的用法實例...

本篇文章主要為大家講述了關于html5 datalist標簽的用法及html5 datalist標簽的用法實例。本文說了兩個常用的選項框的實例供大家選擇觀看&#xff0c;下面就讓我們一起來看這篇文章吧我們先來看看html5 datalist標簽的用法&#xff1a;標簽定義選項列表。請與input元素配合使用…

java treemap_Java TreeMap lastKey()方法與示例

java treemapTreeMap類lastKey()方法 (TreeMap Class lastKey() method) lastKey() method is available in java.util package. lastKey()方法在java.util包中可用。 lastKey() method is used to return the last highest key element value exists in this TreeMap. lastKey…

網上看來的

http://blog.163.com/dong_xiao_yang/blog/static/216138205201321114659430/ http://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20compile%20FFmpeg%20for%20Raspberry%20Pi%20%28Raspbian%29#FFmpegwithlibaacpluslibx264andalsa-lib 編譯環境 Ubuntu 12.04 w64-mingw32下載lib…

閱讀iPhone.3D.Programming(O'Reilly.2010-05) 英文版 第一感覺

最近開始閱讀iPhone.3D.Programming(OReilly.2010-05)&#xff0c;英文版此書&#xff0c;我閱讀到P21了&#xff0c;中間講了一個樣例&#xff0c;HelloArrow在這個過程中&#xff0c;我想簡單點&#xff0c;少打點字&#xff0c;直接拿書中配套來學習&#xff0c;發現一個問題…

【數據結構基礎筆記】【隊列】

代碼參考《妙趣橫生的算法.C語言實現》 文章目錄前言1、隊列定義2、創建一個隊列3、入隊列4、出隊列5、銷毀一個隊列6、循環隊列的概念7、循環隊列的實現8、實例分析前言 本章總結&#xff1a;鏈隊列定義&#xff0c;創建&#xff0c;出隊入隊操作&#xff0c;銷毀操作&#x…

html圖片自動循環輪播圖,js實現圖片無縫循環輪播

本文實例為大家分享了js實現圖片無縫循環輪播的具體代碼&#xff0c;供大家參考&#xff0c;具體內容如下代碼如下Document#container{overflow:hidden;width:400px;height:300px;margin:auto;}#front,#container{display:flex;flex-direction:row;}#container img{width:400px…