java - problems when declaring and assigning a value to a variable -


i have class, variable called palabra, don't know how declare it.

public paraula() {     lletres = new char[maxim];     llargaria = 0; }  public static paraula llegir() {     paraula nova = new paraula();     botarblancs();     while ((lletra != fisequencia) && // no ha acabat la seqüència             (lletra != blanc)) { // hi ha prou espai         nova.lletres[nova.llargaria++] = lletra;         lletra = leercarteclado();     }     return nova; }  public string tostring() {     string msg = "";     (int idx = 0; idx < llargaria; idx++) {         msg += lletres[idx];     }     return msg; }  public boolean esiguala(paraula b) {     boolean iguals = llargaria == b.llargaria;     (int idx = 0; (idx < llargaria) && iguals; idx++) {         iguals = lletres[idx] == b.lletres[idx];     }     return iguals; }  public static boolean iguals(paraula a, paraula b) {     return a.esiguala(b); }  public boolean buida() {     return llargaria == 0; }  public static void botarblancs() {     while (lletra == blanc) {         lletra = leercarteclado();     } }  public static void botarparaula() throws exception {     while ((lletra != '.') && (lletra != blanc)) {         lletra = leercarteclado();     } } static public char leercarteclado() {     char res = '.';     if (frase != null) {         res = frase[indice++];     }     return res; } 

can me?? i'm trying declare 2 paraula variables , comparing them 1 of methods above, i'm having trouble trying assign value paraula. i'm stuck , need help. think can't complicated!!! don't know i'm doing wrong.

paraula tipo; tipo=paraula.llegir(); paraula tipo1; tipo1 = {'t','1'};  // here's doesn't work - (illegal start of expression) 

how can it??

thanks!!

tipo1 = {'t','1'}; // here's doesn't work - (illegal start of expression)

use construct instead:

paraula tipo1; tipo1 = {       lletres[0] = 't',      llargaria = 1 }; 

your code missed definition constant belongs variable. moreover, tried set 1 char ('1') , not int ( 1);


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -