Java, introdução a sintaxe


Published on

BarreirasJUG introdução sobre a sintaxe java.

Published in: Technology, News & Politics
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Java, introdução a sintaxe

  1. 1. INTRODUÇÃO ASINTAXE JAVA.Pedro HenriqueGrupo de Usuários Java de Barreiras/BA - BarreirasJUG
  2. 2. Por que o símbolo é uma xícara Begin forwarded message:From: James GoslingDate: August 24, 2007 8:16:58 PM PDTTo: Jonathan SchwartzSubject: How was Java named?The story goes like this:We needed a name. We had been using "oak" (which was selected essentially randomly by me), and while theteam had grown attached to it, the trademark lawyers ruled it out. We had lots of email debates about names, butnothing got resolved. We ended up in the awkward position where the #1 thing stopping us from shipping was thename.Our marketing lead knew someone who was a "naming consultant" (I dont remember his name, but he wasgreat). We could neither afford the price nor the time of a conventional product naming process. He agreed to dosomething rather odd, but effective and quick: he acted as a facilitator at a meeting where about a dozen of uslocked ourselves in a room for an afternoon. He started asking us questions like "How does this thing makeyou feel?" (Excited!) "What else makes you feel that way?" (Java!) We ended up with a board covered withessentially random words. Then he put us through a sorting process where we ended up with a ranking of thenames. We ended up with a dozen name candidates and sent them off to the lawyers: they worked down the listuntil they hit one that cleared their search. "Java" was the fourth name on the list. The first name on the list was"Silk", which I hated but everyone else liked. My favorite was "Lyric", the third one on the list, but it didnt pass thelawyers test. I dont remember what the other candidate names where.So, who named Java? Marketing organized the meeting, the consultant ran it, and a whole pile of us did a lot ofyelling out of random words. Im honestly not real sure who said "Java" first, but Im pretty sure it was MarkOpperman.There certainly wasnt any brilliant marketing mind who went through a coherent thought process.
  3. 3. Siglas nossas de cada dia Mais siglas JVM – Java Virtual Machine HotSpot JIT – Just in time compiler JRE – Java Runtime Environment = JVM + API +...
  4. 4. Quais os ingredientes ? Qual dos itens da sopa de letrinhasprecisamos ? JDK ? JDK + IDE (Aconselhável).
  5. 5. Como funciona ?
  6. 6. Primeiro programa ?
  7. 7. { Classe “Em orientação a objetos, uma classe é umaestrutura que abstrai um conjunto de objetos comcaracterísticas similares.” - Wikipédia Objeto “Objeto também considerado como uma instânciade uma classe, quando um objeto é criado eleprecisa ser inicializado, ou seja, para uma classepodemos ter vários objetos.” - Wikipédia
  8. 8. Classe e Objeto
  9. 9. Variáveis O que são variáveis Começar sempre com alfanuméricos ou _, $ Não pode ser palavra reservada, nem espaçosem branco.Data TypeDefault Value (forfields)byte 0short 0int 0long 0Lfloat 0.0fdouble 0.0dchar u0000String (or any object) nullboolean false
  10. 10. Comentários O que são comentários ? // /**/ /** */
  11. 11. Array Sintaxe do Arrayint[] arrayDeInteiros;byte[] anArrayOfBytes;short[] anArrayOfShorts;long[] anArrayOfLongs;float[] anArrayOfFloats;double[] anArrayOfDoubles;boolean[] anArrayOfBooleans;char[] anArrayOfChars;String[] anArrayOfStrings;class MultiDimArrayDemo {public static void main(String[] args) {String[] names = {"Smith", "Jones"}; // Meu array denomesSystem.out.println(names[0]); // SmithSystem.out.println(names[1]); // Jones}}
  12. 12. Estruturas de controle if ( condição ) { } else { } switch (enum, byte, short, char, int ){ case valor: comandos; default:comandos;} while (condição){ } for(int i=0; i < 10; i++){} ou for (Item i: lista){}
  13. 13. Perguntas