我目前正在尝试在Google Chrome浏览器中打开在Visual Studio中编写的html文件,并在Visual Studio中运行Google Chrome浏览器调试扩展
以下是.json文件,我正在使用第一个配置
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Chrome against localhost, with sourcemaps",
"type": "chrome",
"request": "launch",
"url": "http://localhost:8080",
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
},
{
"name": "Attach to Chrome, with sourcemaps",
"type": "chrome",
"request": "attach",
"port": 9222,
"sourceMaps": true,
"webRoot": "${workspaceRoot}"
}
]
Run Code Online (Sandbox Code Playgroud)
但是当它在谷歌浏览器中打开时我收到错误
无法访问该网站
本地主机拒绝连接。
只是想知道创建具有相同签名的方法的最佳实践是什么
情况1
public void transfer(Department department){
this.department = department;
}
public void transfer(Department department,String postion){
this.department = department;
this.postion = position;
}
Run Code Online (Sandbox Code Playgroud)
案例2
public void transfer(Department department){
this.department = department;
}
public void transfer(Department department,String postion){
transfer(department);
this.postion = position;
}
Run Code Online (Sandbox Code Playgroud)