Editor HTML

Petr Lampa lampa at fee.vutbr.cz
Mon Nov 6 09:17:42 CET 1995


>
> > > V podstate souhlasim s panem Zajickem a mam doplnujici dotaz, ktery
> > > by mohl pomoci nam, kteri si netroufaji (nebo se jim nechce) ucit se
> > > dalsi programovaci jazyk v obtiznosti raditelny k "C/C++". Ma jiz
> > > nekdo zkusenosti s osekanou verzi Javy tzv. JavaLite ?
> >
> > Java je sice jazyk podobny C++, ale znacne jednodussi. Oproti C++ se
> > v nem nevyskytuji (prominte, nazvy znam jenom v anglictine) Typedefs,
> > Defines, Preprocessor, Structures a Unions, Functions,
> > Multiple Inheritance a Interfaces, Goto Statements, Operator
> > Overloading, Automatic Coercions a Pointers.
>                                      ^^^^^^^^
>                                      Jak se pracuje s retezci?
>

Retezec ve smyslu C neexistuje, String je zabudovana trida. Priklad z White
Paper o Jave snad rekne vice:

class ReverseString {
	public static String reverseIt(String source)
	{
		int i, len = source.length();
		StringBuffer dest = new StringBuffer(len);

		for (i = len - 1; i >= 0; i--) {
			dest.appendChar(source.charAt(i));
		}
		return dest.toString();
	}
}

Jedina metoda strukturalizace typu je trida (jednoducha dedicnost) a pole
(s pevnou delkou a kontrolovanymi indexy).  Ukazatel sice neexistuje,
ale lze vytvaret instance objektu:
	Object arrray[];
	array = new Object[10];

							Petr Lampa

--
Technical University of Brno			 E-mail: lampa at fee.vutbr.cz
Faculty of El. Engineering and Comp. Science	 Phone: (+42 5) 7275/111,225
Department of Computer Science and Engineering   Fax:  (+42 5) 41211141
Bozetechova 2, 612 66 Brno, Czech Republic



More information about the net mailing list