2009-01-09 14:13:17 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2002 - 2008 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*****************************************************************************/
|
2008-12-16 15:14:00 +00:00
|
|
|
public class Scoping2 {
|
2013-04-30 03:33:18 +00:00
|
|
|
public static void main(String[] args) {
|
2017-05-12 16:09:00 +00:00
|
|
|
@SuppressWarnings("unused")
|
2013-04-30 03:33:18 +00:00
|
|
|
Scoping2 s2 = new Scoping2();
|
|
|
|
{
|
|
|
|
final int x = 5;
|
|
|
|
System.out.println(x);
|
|
|
|
(new Object() {
|
|
|
|
public void foo() {
|
|
|
|
System.out.println("x = " + x);
|
|
|
|
}
|
|
|
|
}).foo();
|
2008-12-16 15:14:00 +00:00
|
|
|
}
|
2013-04-30 03:33:18 +00:00
|
|
|
{
|
|
|
|
double x = 3.14;
|
|
|
|
System.out.println(x);
|
|
|
|
}
|
|
|
|
}
|
2017-02-03 01:33:27 +00:00
|
|
|
}
|