我正面临这个问题
sparsh610@DESKTOP-551C51M:/mnt/e/xxxxxxxxx$ ./gradlew mm
: not found2: ./gradlew:
: not found8: ./gradlew:
./gradlew: 52: ./gradlew: Syntax error: word unexpected (expecting "in")
Run Code Online (Sandbox Code Playgroud)
我确认我的系统已安装 gradle 并具有所有读写访问权限。
此错误的任何具体原因?
已经检查过这个链接
我正在学习核心java中的静态块功能.
public class ClassResolution {
static class Parent {
public static String name = "Sparsh";
static {
System.out.println("this is Parent");
name = "Parent";
}
}
static class Child extends Parent {
static {
System.out.println("this is Child");
name = "Child";
}
}
public static void main(String[] args) throws ClassNotFoundException {
System.out.println(Child.name);
}
}
Run Code Online (Sandbox Code Playgroud)
我认为输出将是:
this is Parent
this is Child
Child
Run Code Online (Sandbox Code Playgroud)
但实际输出是:
this is Parent
Parent
Run Code Online (Sandbox Code Playgroud)
而且我不知道为什么.
我将angular.min.js添加到我的项目中并遇到了这个问题.
http:// localhost:8000/AngularProject/angular.min.js.map 404(未找到)angular.min.js.map:1
经过研究,我发现添加angular.min.js.map摆脱了"404(未找到)"错误.我还找到了"angular.min.js.map"的原因:我们添加它是因为"源映射文件基本上将缩小的代码转换为其未经编译的版本以进行调试".
但是,这不是使用缩小文件节省空间并使应用程序更快的原因吗?现在,如果我们使用angular.min.js,我们还必须添加angular.min.js.map.
添加angular.js而不是添加两个文件(angular.min.js,angular.min.js.map)不是更简单.拥有angular.js的缩小版本是什么意思?
在阅读本教程时,我遇到了一个奇怪的情况。
在您将服务注入组件中时,如果错过了访问修饰符,则会出现以下错误,但将其添加为私有或公共运行会很好。
如果错过了访问修饰符,我们在Angular中没有任何默认范围吗?
export class UserDetailsComponent implements OnInit {
name="";
lastName="";
constructor(userService : UserServiceService) { }
ngOnInit() {
}
save(){
this.userService.saveUser();
}
}
Run Code Online (Sandbox Code Playgroud)
类型'UserDetailsComponent'上不存在属性'userService'。
我具有将请求从前端连续发送到后端的功能。所以我添加了如下代码。
我想以第一个请求立即发出然后在两分钟后发出的方式实施。
但使用下面的代码并根据间隔的定义,它将在两分钟后发送第一个请求。
this.getData = Observable.interval(2 * 60 * 1000)
.pipe(flatMap(() => this.service.getData(b, b, b, b, b, b))).subscribe();
Run Code Online (Sandbox Code Playgroud)
我不想通过先添加请求然后添加上述代码来重复代码,也不想通过任何其他方式来完成它。
我正在执行命令
ng g interceptor error
Run Code Online (Sandbox Code Playgroud)
其中 error 是拦截器的名称
但面临如下问题:
An unhandled exception occurred: Schematic "interceptor" not found in collection "@schematics/angular".
Run Code Online (Sandbox Code Playgroud)
我们是否必须先安装任何软件包?
我将singleton对象的引用赋值为null.
但它仍然是调用Singleton类的方法.
这是我的代码
class Singleton {
private static Singleton singleton = new Singleton();
/*
* A private Constructor prevents any other class from instantiating.
*/
private Singleton() {
}
/* Static 'instance' method */
public static Singleton getInstance() {
return singleton;
}
/* Other methods protected by singleton-ness */
protected static void demoMethod() {
System.out.println("demoMethod for singleton");
}
}
public class SingletonDemo {
public static void main(String[] args) {
Singleton tmp = Singleton.getInstance();
tmp.demoMethod();
tmp = null;
tmp.demoMethod();
}
}
Run Code Online (Sandbox Code Playgroud)

如果我们没有在默认情况下向方法添加任何访问说明符,则它是默认类型。
但是我们添加了default关键字然后它给了我错误,就像我们只能在接口中使用默认方法一样。我知道函数式接口中的默认方法,但奇怪为什么它在 eclipse 中显示错误。
public class Test
{
default void test() { //Default methods are allowed only in interfaces.
}
}
Run Code Online (Sandbox Code Playgroud)
这个工作正常
public class Test
{
void test()
{
}
}
Run Code Online (Sandbox Code Playgroud)
有什么理由吗?
java ×4
angular ×3
angular8 ×2
angular6 ×1
angularjs ×1
caching ×1
gradle ×1
gradlew ×1
java-6 ×1
java-8 ×1
javascript ×1
minify ×1
observable ×1
rxjs ×1
singleton ×1
source-maps ×1
typescript ×1