java - getting erors i dont know why -



java - getting erors i dont know why -

class emailadress { public static string fname; public static string lname; public static string org1; public static string org2; public static string domain; public static void main(string[] args) { out.println("bitte geben sie eine email-adresse ein:"); fname = in.readindentifier(); if (!in.done()) { out.println("fname nicht gelessen"); return; } char c1 = in.read(); if (c1 !== ('.' || '@')) { out.println("@ erwartet"); return; } if (c1.equals('.')) { lname = in.readindentifier(); } else { org1 = in.readindentifier(); return; } char c2 = in.read(); if (c2 !== ".") { out.println(". erwartet"); return; } org2 = in.readindentifier(); if (!in.done()) { domain = in.readindentifier(); } if (!doman.equals("at" || "com" || "net")) { out.println("at, com, net erwartet"); return; } out.println("korrekte email erkannt!"); out.println("name:" + fname + " " + lname); out.println("organisation:" + org1 + " " + org2); out.println("email:" + fname + c1 + lname + org1 + c2 + org2 + domain); } }

i cant compile code, dont understand why in.readindentifier method can use, in.done can easy mistakes (im bagginer) help appriciated, or u can suggest way check grammar of string

there weird things in code, not sure in , outbut here first thing

if (c1 !== ('.' || '@'))

it should be

if (c1 != '.' && c1 !='@')

this another

if (c2 !== ".")

java not javascript , comparsion using == or !=

and 1 more

if (!doman.equals("at" || "com" || "net")) {

equals takes object parameter not hmm... invalid operation need split in

if (!(doman.equals("at")&&doman.equals("com")&&doman.equals("new")))

and one

char c1 = in.read(); ... if (c1.equals('.'))

c1 primitive not object, doesnt have method equals

java compilation expression

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

java - Parsing XML, skip certain tags -

c# - ASP.NET MVC Sequence contains no matching element -