Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7840585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:50:13+00:00 2026-06-02T15:50:13+00:00

Why I cannot put a breakpoint on line String a; ? public void localMethod()

  • 0

Why I cannot put a breakpoint on line String a;?

public void localMethod() {
    String a;
    a = "haha";
    System.out.println(a);
}

I know local variable will not be initialized until I assign a value to it explicitly.
But it is a line of code, it does something. Why I cannot stop there?
What lines are eligible to be breakpoints?

I am using Eclipse, jdk6_31

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:50:15+00:00Added an answer on June 2, 2026 at 3:50 pm

    The declaration itself isn’t really executable code – it’s just declaring the existence of something. You should be able to put a breakpoint on the second line, which actually does something.

    Admittedly I don’t see any reason why an IDE shouldn’t support the notion of adding a breakpoint to a non-executable line – it would probably have to really install the breakpoint at an executable point within the executing environment…

    EDIT: To clarify what I mean, this code:

    public void foo() {
        String a;
        String b;
        a = "hello";
        b = " world";
        System.out.println(a + b);        
    }
    

    will compile to the same bytecode as:

    public void foo() {
        String a;
        a = "hello";
        String b;
        b = " world";
        System.out.println(a + b);        
    }
    

    No code has to execute due to a declaration – it doesn’t reserve space at that point in time or anything like that. The compiler allocates a “slot” within the method’s stack space, and will use that slot throughout the method – but it can reuse that same slot with no extra initialization even if the variable is declared within a loop, for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

experts, I know I cannot put a ListView inside a ScrollView, but the UI
I cannot put my WAMP server online. I recently add a php extention (php_mssql.dll)
I cannot put jChceckBox to jTable cell. More likely I can put checkBox to
Since I cannot put conditions on elements in a component, I have to separate
When using IE, you cannot put an absolutely positioned div over a select input
Put it another way: what code have you written that cannot fail. I'm interested
I'm trying to set up log4net but I cannot make it work. I've put
I have an html page where I cannot put a DOCTYPE (I am not
I read somwhere that you cannot put millions of files inside a single folder,
I have read O'Reilly book, in that I came to know this get-put principle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.