Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: illegal start of expression

  1. #1
    Junior Member
    Join Date
    Feb 2018
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Lightbulb illegal start of expression

    Hello,

    I need help in this little code error canīt find any help online.

    public class Variablen1 {
      public static void main(String [] args) {
     
      byte bZahl = 28;
      short sZahl = -1843;
      int iZahl = 4356576;
      long lZahl = 345236577970L;
      float fZahl = 4.37456678;
      double dZahl = 3645.564782;
      boolean bestanden = true;
      char zeichen = %;
      System.out.println(bZahl);
      System.out.println(sZahl);
      System.out.println(iZahl);
      System.out.println(lZahl);
      System.out.println(fZahl);
      System.out.println(dZahl);
      System.out.println(bestanden);
      System.out.println(zeichen);
     }
    }

    [error]
    H:\Java\Programme\JavaUebung02>javac Variablen1.java
    Variablen1.java:11: error: illegal start of expression
    char zeichen = %;
    ^
    Variablen1.java:11: error: illegal start of expression
    char zeichen = %;
    ^
    2 errors
    [/error]

    Thanks a lot.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: illegal start of expression

    char values need to be enclosed in 's
    For example: '$'
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    wac (February 11th, 2018)

Similar Threads

  1. Illegal start of expression.
    By finding_my_inner_geek in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 25th, 2013, 08:59 AM
  2. Illegal start of expression!
    By NoobOfTheMonth in forum What's Wrong With My Code?
    Replies: 9
    Last Post: February 11th, 2013, 09:53 PM
  3. Help With illegal start of expression
    By inshal in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 9th, 2013, 01:20 PM
  4. need help with illegal start of expression
    By inshal in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 9th, 2013, 11:25 AM
  5. Help With illegal start of expression
    By RaceRed in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 7th, 2013, 09:02 PM