Cov txheej txheem:

Dab tsi yog siv los ua txhua qhov kev tawm tswv yim thiab tso tawm haujlwm Java?
Dab tsi yog siv los ua txhua qhov kev tawm tswv yim thiab tso tawm haujlwm Java?

Video: Dab tsi yog siv los ua txhua qhov kev tawm tswv yim thiab tso tawm haujlwm Java?

Video: Dab tsi yog siv los ua txhua qhov kev tawm tswv yim thiab tso tawm haujlwm Java?
Video: Leng Yang - Yog Vim Dab Tsi (Official Full Song | Nkauj Tawm Tshiab) 2020/05/24 2024, Kaum ib hlis
Anonim

Piav: AWT stands rau Abstract Window Toolkit, nws yog siv los ntawm applets los cuam tshuam nrog tus neeg siv. 2. Qhov twg yog qhov no siv los ua txhua qhov kev tawm tswv yim & tso zis ua haujlwm hauv Java ? Piav: Zoo li hauv lwm yam lus, ntws yog siv rau input thiab output ua hauj lwm.

Ib yam li ntawd, cov chav kawm twg yog siv rau kev tawm tswv yim thiab tso tawm thaum ua haujlwm nrog bytes?

Kev piav qhia: InputStream & OutputStream yog tsim los rau byte ntws. Tus nyeem ntawv thiab sau ntawv yog tsim los rau tus cwj pwm ntws.

Tsis tas li ntawd, ob hom I O muaj dab tsi hauv Java? Byte kwj thiab tus cwj pwm kwj. Muaj ob hom ntawm kwj hauv Java : byte thiab cim. Thaum twg kuv / O kwj tswj 8-ntsis bytes ntawm raw cov ntaub ntawv binary, nws yog hu ua byte kwj. Thiab, thaum kuv / O kwj tswj 16-ntsis Unicode cim, nws yog hu ua tus cim kwj.

Tom qab, lo lus nug yog, dab tsi yog input thiab output kwj?

Nyeem thiab sau cov ntaub ntawv. Raws li tau piav ua ntej, a ntws tuaj yeem txhais tau tias yog ib ntu ntawm cov ntaub ntawv. InputStream yog siv los nyeem cov ntaub ntawv los ntawm ib qhov chaw thiab cov OutputStream yog siv los sau cov ntaub ntawv mus rau qhov chaw. Ntawm no yog ib tug hierarchy ntawm cov chav kawm los nrog Input thiab Output kwj.

Yuav ua li cas koj input thiab output ib txoj hlua nyob rau hauv Java?

Java programming source code

  1. import java. siv. Lub tshuab luam ntawv;
  2. chav GetInputFromUser {
  3. public static void main(String args) {
  4. ib a; ntab b; Txoj hlua s;
  5. Scanner hauv = new Scanner(System. in);
  6. Qhov system. tawm. println("Sau ib txoj hlua");
  7. s = in. nextLine();
  8. Qhov system. tawm. println("Koj nkag mus "+s);

Pom zoo: