O GoConqr está de visual novo! Conte para nós o que você achou.

Notas

java intro

Mohamed Amireddine Ghezala Inglês 5 páginas

Conteúdo das notas (5)

Página 1

chapter 1:

access modifiers:

default:The data members, class or methods which are not declared using any access modifiers i.e. having default access modifier are accessible only within the same package.

private:The methods or data members declared as private are accessible only within the class in which they are declared.

if u have two packages u need to import the one that you gonna use its classes in the other one. import p1.*;

protected:The methods or data members declared as protected are accessible within same package or sub classes in different package.

public:Classes, methods or data members which are declared as public are accessible from every where in the program. There is no restriction on the scope of a public data members.

static: When a member is declared static, it can be accessed before any objects of its class are created, and without reference to any object.

a program is defined by one or more classes.

The Java interpreter executes the application by invoking (calling) the main method.

In Java, every method must be part of some class which is different from languages like C, C++ and Python.

Página 2

chapter 2:

int newNum = 10 *++i; // increment i first then use it;

int newNum = 10 i++; // use i then incrment it.

widening in casting is implicit; up to down byte->short->int->long->float->double.

narrowing is explicit. down to up

when assigning a charecter to integer , its implicit casting;

when u assign a integer to charecter its an explicit casting.

import java.util.*; to use Scanner class.

ex to know the number of tokens:

StringTokenizer st = new StringTokenizer("amir nossa");

// counting tokens

System.out.println("Total tokens : " + st.countTokens());

FileInputStream and FileOutputStream are io package classes .

Output files

• PrintWriter • FileOutputStream

Input files •

BufferReader • FileReader

visit google doc to see how to read and how to write to a file

PrintWriter outputStream = new PrintWriter(new FileOutputStream("out.txt")); ////short way

FileOutputStream s = new FileOutputStream("out.txt"); ///long way

PrintWriter outputStream = new PrintWriter(s);

Página 3

Questions and things to revise back:

-list of reserved words.

-float vs double https://www.geeksforgeeks.org/comparision-double-float-primitive-types-java/

- number literals

- create and intialize d array

- class variables, instance variabesm, object refrence, refrnce variab;les.

- check (this) in the last slide of chap 9

- memorize the file creating, writing.

- memorize the string functions chap 8

-memorize the delimeters

- memorize2d array

-at 11 inheritance,polymorphism,abstract, interface

Página 4

chapter 5

Int [] newArray = Arrays.copyOf(oldArray, newArray.length);///copy newarry into oldarray

Arrays.sort(arr); /// sort the array

Arrays.toString(arr)) print the array [1,2]

how to creae and initialize a 2d array:

int matrix[][] = new int[10][10];

for (int i=0; i

Página 5

Informações

Descrição
Notas sobre java intro, criado por Mohamed Amireddine Ghezala em 12-10-2018.
Criado por
Mohamed Amireddine Ghezala · out 2018
Atualizado
21 out 2018
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?